Reputation: 31
I can get my fancybox to display on page load, but it would great if it could be delayed just a second or two. Is there a way? This is what I have now:
$(document).ready(function(){
$("#div_id").fancybox({
//fancybox options
});
$("#div_id").trigger('click');
});
I have tried a number of things to delay invoking the load and... no luck.
Upvotes: 1
Views: 2374
Reputation: 17274
$(document).ready(function(){
setTimeout(function(){
$("#div_id").fancybox({
//fancybox options
});
$("#div_id").trigger('click');
}, 1000);
});
See here: jsfiddle - I have added a click alert and fancy
class as an example.
Upvotes: 0
Reputation: 940
$(document).ready(function(){
$("#div_id").fancybox({
//fancybox options
});
// One second delay
setTimeout(function(){
$("#div_id").click();
}, 1000);
});
Upvotes: 1