Tiny Clean Cookie Consent Bar In jQuery - GRT

Tiny Clean Cookie Consent Bar In jQuery - GRT
File Size: 8.06 KB
Views Total: 1043
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

GRT Cookie Consent is a super tiny jQuery plugin to make your website comply with the GDPR and EU cookie law.

The plugin creates a sticky bottom cookie consent bar to inform your users that your site uses cookies.

The plugin displays the cookie consent bar on the user's first visit to your website and, by default, automatically saves the user's choice for 365 days.

How to use it:

1. Load the stylesheet grt-cookies-consent.css for the basic styling of the cookie consent bar.

<link rel="stylesheet" href="grt-cookies-consent.css" />

2. Add information about cookies use to the cookie consent bar.

<div class="grt-cookie">
  <div class="grt-cookies-msg">
    <p>
      We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you accept and understand our <a href="#">Privacy Policy</a>, and our <a href="#">Terms of Service</a>.
    </p>
  </div>
  <span class="grt-cookie-button">Accept</span>
</div>

3. Load the JavaScript grt-cookie-consent.js after jQuery but before the closing body tag.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="grt-cookie-consent.js"></script>

4. Initialize the plugin with default settings.

$(".grt-cookies").grtCookie();

5. Customize the appearance of the cookie consent bar.

$(".grt-cookies").grtCookie({
  textcolor: "#333",
  background: "#fff",
  buttonbackground: "#333",
  buttontextcolor: "#fff",
});

6. Customize the cookie expiration date. Default: 365.

$(".grt-cookies").grtCookie({
  duration: 730
});

This awesome jQuery plugin is developed by grt107. For more Advanced Usages, please check the demo page or visit the official website.