EU Cookie Notice Bar With Vanilla JavaScript – cookiebar

Category: Javascript , Notification | May 30, 2018
Author: janmarkuslanger
Views Total: 208
Official Page: Go to website
Last Update: May 30, 2018
License: MIT

Preview:

EU Cookie Notice Bar With Vanilla JavaScript – cookiebar

Description:

cookiebar is a vanilla JavaScript library that detects the page language and displays a multi-language EU cookies law notice on page load.

How to use it:

Load the required ‘cookiebar.css’ and ‘cookiebar.js’ files in the web page.

<link rel="stylesheet" href="cookiebar.css">
<script src="cookiebar.js"></script>

Initialize the cookiebar library and done.

Cookiebar.init();

Customize the default notice message.

var data = [
    {
      lang: ['de-CH', 'de-AT', 'de-LU', 'de-LI', 'de'],
      text: 'Diese Seite benutzt Cookies.',
      close: 'Einverstanden!'
    },
    {
      lang: ['en', 'en-US', 'en-EG', 'en-AU', 'en-GB', 'en-CA', 'en-NZ', 'en-IE', 'en-ZA', 'en-JM', 'en-BZ', 'en-TT'],
      text: 'This Site uses Cookies.',
      close: 'Accept!'
    }
];

Changelog:

05/30/2018

  • Refactor

Leave a Reply