Last active
November 23, 2022 10:13
-
-
Save keithgreer/5ab7d2606c78b67b779caf16907ab059 to your computer and use it in GitHub Desktop.
Simple jQuery Cookie Pop-up - https://keithgreer.dev/simple-jquery-cookie-pop-up-notification-for-legacy-websites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.eucookie-pop-up { display:none; position:fixed; z-index:9999; bottom:0; left:0; right:0; background:#dc143c; color:#fff; margin:1em; padding:0.5em; text-align:center; } | |
.eucookie-pop-up .dismiss { float:right; width:7% text-align:center; padding-top:1em; } | |
.eucookie-pop-up .dismiss a { color:#fff; cursor:pointer; font-weight:bold; font-size:150%; padding:1em; } | |
.eucookie-pop-up .content { float:left; width:92%; text-align:center; } | |
.eucookie-pop-up .content a { text-decoration: underline;color:#fff } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="privacy-pop-up" class="eucookie-pop-up"> | |
<div class="dismiss"> | |
<a id="exit-popup">X</a> | |
</div> | |
<div class="content"> | |
<strong>Important information regarding cookies</strong><br> | |
By using this website, you consent to the use of cookies in accordance with our | |
<a href="https://example.com/privacy-policy-cookies">Privacy Policy</a>. | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
if(localStorage.getItem('eucookie') != '123'){ | |
jQuery("#privacy-pop-up").delay(1).fadeIn(1000); | |
localStorage.setItem('eucookie','123'); | |
} | |
jQuery('#exit-popup').click(function(e) { | |
jQuery('#privacy-pop-up').fadeOut(1000); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment