1.0.1 • Published 6 years ago
cookies-banner v1.0.1
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();