/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function() { if ($.cookie('notice') == 'closed') { $('.notice').hide(); } else { $('.notice').show(); } // Show or hide on load depending on cookie $('.notice a.close').click(function(e) { e.preventDefault(); $.cookie('notice','closed'); $(this).parent().hide(); }); // Simple close link to hide the notice until cookies are cleared $('a.open').click(function(e) { e.preventDefault(); $.cookie('notice','open'); $('.notice').show(); }); // Opener link to show the notice again });