Skip to content

Instantly share code, notes, and snippets.

@lightyrs
Created May 27, 2011 14:56
Show Gist options
  • Save lightyrs/995412 to your computer and use it in GitHub Desktop.
Save lightyrs/995412 to your computer and use it in GitHub Desktop.
Basic pattern for displaying content once per user
/* Basic pattern for displaying content once per user
using http://code.google.com/p/cookies/ plugin.
*/
$(function(){
var lightbox_cookie = $.cookies.get('lightbox_shown');
var $lightbox = $('iframe#warriors_lightbox, div#warriors_overlay');
if (lightbox_cookie == null) {
$lightbox.fadeIn(300, function(){
$.cookies.set( 'lightbox_shown', 'true' );
});
}
var lightbox_close = $('iframe#warriors_lightbox").contents().find("a.close-button');
lightbox_close.click(function(e){
$lightbox.fadeOut(300);
e.preventDefault();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment