public
Created

Basic pattern for displaying content once per user

  • Download Gist
cookies_pattern.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* 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();
});
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.