cookies-banner

1.0.1 • Public • Published

Cookies Banner

Manage cookies banner, by hide it when click on a button for a specific number of days.

Installation

Download and install npm at www.npmjs.com/get-npm if you haven't already.

npm install cookies-banner

This package is provided in ES6 module format.

Usage

In your html, the cookies banner must have cookiesBanner as id, and the button wich close the banner must have closeCookiesBanner as id.

<div id="cookiesBanner">
    This website use cookies. <a href="">Learn more</a>
    <button id="closeCookiesBanner">I accept</button>
</div>

In the js :

import CookiesBanner from 'cookies-banner';
CookiesBanner.init();

And it's all ! When the user will click on closeCookiesBanner, the banner will be closed for 15 days by default. To change this duration (to 30 days for example), you can do :

import CookiesBanner from 'cookies-banner';
CookiesBanner.days = 30;
CookiesBanner.init();

Dependencies

License

ISC

Package Sidebar

Install

npm i cookies-banner

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • mahdrentys