-
-
Save bavington/6727776 to your computer and use it in GitHub Desktop.
Hi,
I've created a little fork of this one, as I think it's more user friendly to create the cookie when the user click on "close" instead of pushing the cookie once the text is displayed...
If you implement that in next version let me know so i'll trash that fork.
Cheers.
Thanks for sharing. I implemented this solution, but I noticed that when I refresh, the banner is removed. It's a normal behaviour?
Anybody could help, how to update this code? Because it is disappear on refresh?
It disappears, as it should, because it is assumed that you have agreed to it. That's what's in the text. It will re-appear after 14 days. Visitors won't want to see it every time they visit the page.
To see it again, delete the domain cookies for this site.
Hi,
what should the following code do?
if(window.dropCookie){ document.cookie = name+"="+value+expires+"; path=/"; }
Can't find a dropCookie property on the window object.
Best regards.
You can use this css:
/* [COOKIE BANNER] */
#cookie-law {
position: fixed;
z-index: 99999;
background: white;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
text-align: center;
padding: 30px 0;
right: 0;
bottom: 0;
left: 0;
}
#cookie-law p {
margin: 0;
}
.close-cookie-banner span {
position: absolute;
top: 0;
color: black;
font-size: 25px;
}
/* [/COOKIE BANNER] */
I created a fork which does not pollute the global namespace.
Also, it per default requires a click to make the banner stay away, but can easily be modified to only show once in a while, like this.
For future Googlers: This script is NOT legally valid anymore.
https://www.reuters.com/article/us-eu-court-cookies/internet-users-must-actively-consent-to-use-of-cookies-eu-court-rules-idUSKBN1WG3NF
[...] cookie consent must be specific and explicit and that clicking a button to participate in a game or browsing a website, and through that allowing cookies, was not enough.
Thanks @bavington and @timgerhard, this is simple and useful. I did a minor change as some people said, refreshing the page without closing the banner, it will just disappear, when createCookie function is called I create the cookie with a different value let's say "off" so if you reload the page function checkCookie looks for specific value, since it is different it will display the banner again when the user clicks to close the banner function removeMe is invoked so there I update the cookie value to "on".
Thanks.
thanks a lot, smashing help guys ;)