Skip to content

adrcav/cookies-notification

Repository files navigation

🍪 CookiesNotification

jsdelivr hits Build Status Dependencies License: MIT

A simple and lightweight cookies consent notification.

Preview

Preview

Installation

You can use CookiesNotification from CDN or manual download. There are no dependencies, so you can import and just start.

<!-- head -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/adrcav/cookies-notification@latest/dist/css/cookies-notification.min.css">

<!-- body -->
<script src="https://cdn.jsdelivr.net/gh/adrcav/cookies-notification@latest/dist/js/cookies-notification.min.js"></script>

If you have imported CookiesNotification via one of the above methods, you are ready to get started.

Usage

Here's an example of a basic implementation:

const cookies = new CookiesNotification();

You can also customize the notification, here's a default options:

const options = {
  container: document.body,
  message: 'We use cookies and others technologies to make interactions with our services easy and meaningful. By continuing to use this site you are giving us your consent to do this.',
  confirmButton: 'Got it',
  showCancelButton: false,
  cancelButton: 'Decline',
  position: 'left',
  borderColor: '#333333',
  remember: 365
};

const cookies = new CookiesNotification(options);

License

This project is licensed under the MIT License - see the LICENSE file for details