Search code examples
javascriptpopupfancyboxlightbox

inline lightbox pops up after 20 seconds


Is there a lightbox that would allow me to tell it to pop up after a user has been on my site for 20 seconds (or other user defined time)?

I want to do it for a competition allowing the next 100 people to like us on facebook to be entered into a draw to win a prize.

Any ideas of a script that does this or how I could mod fancybox to do this?


Solution

  • you can delay any action in javascript using the setTimeout method:

    setTimeout(function() {
       // put code here you want to happen 20 seconds later
    }, 20000); // time is in milliseconds