Return to Snippet

Revision: 27919
at June 26, 2010 23:18 by phil7085


Initial Code
$(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

});

Initial URL


Initial Description


Initial Title
Simple use of jQuery cookie plugin to show/hide a notice

Initial Tags
plugin, jquery

Initial Language
JavaScript