1) Download this file: http://www.primebox.co.uk/files/uploads/jquery.cookiebar.zip
2) Unzip the file and put in the vendor folder.
3) Add it in the HTML file:
CSS:
JS:
4) Initialize the Script:
(js/custom.js)
$(document).ready(function(){
$.cookieBar({
message: 'We use cookies to track usage and preferences',
acceptButton: true,
acceptText: 'I Understand',
declineButton: false,
declineText: 'Disable Cookies',
policyButton: true,
policyText: 'Privacy Policy',
policyURL: '/privacy-policy/',
autoEnable: true,
acceptOnContinue: false,
expireDays: 365,
forceShow: false,
effect: 'slide',
element: 'body',
append: false,
fixed: false,
bottom: false,
zindex: '',
redirect: '/'
});
});
5) Change CSS:
(css/custom.css)
#cookie-bar {
background-color: #171717;
height: 40px;
z-index: 99999;
padding: 8px 0;
}
6) How to test on your code if the cookies were accepted:
if(jQuery.cookieBar('cookies')){
// Cookies were accepted!
}
7) More information: http://www.primebox.co.uk/projects/jquery-cookiebar/