Reputation: 313
im trying to make a lightbox popup that triggers is the user has not been to the site before telling them about a offer ... like the one here http://www.made.com/ (if youve been there befor you need to clear your cookies )
any way id like to do it using the fancybox lightbox as im using it on my page else where already, i was trying to figure it out from here http://www.veign.com/blog/2008/05/22/create-a-one-time-popup-using-jquery/ but the link to the jquery cookie libary is down.
any idea on where i can find a replacment / is this the best way to do it ?
regards
Upvotes: 0
Views: 5148
Reputation: 1772
Using the utility functions at the bottom of this page: http://www.quirksmode.org/js/cookies.html (createCookie and readCookie)
$(document).ready(function(){
if (readCookie("hasVisitedBefore") == null){
//code to create popup here
}
createCookie("hasVisitedBefore", "true");
});
This will set a cookie using javascript when the user loads the page. If the cookie wasn't set when they arrived then you can launch your normal popup code.
Upvotes: 1