David Bonnici
David Bonnici

Reputation: 6747

JQuery Colorbox

How can I show Colorbox on page load without event binding? In a more simple term I would like the Colorbox to load immediately on page load.

this is the Colorbox which I am currently using http://colorpowered.com/colorbox/

Upvotes: 2

Views: 4764

Answers (2)

Eduardo
Eduardo

Reputation: 7841

Have you tried:

$(document).ready(function(){
   $.fn.colorbox();
}

That is, if you make it:

$(document).ready(function(){
   alert('page loaded');
}

Then the alert will popup when the page has finished loading. So it's a matter of just replacing with the call that pops up the colorbox, which seems the one above (haven't tried though).

Upvotes: -1

Doug Neiner
Doug Neiner

Reputation: 66191

You need to pass the open:true key/value set to the constructor if you want it to open without user interaction:

 $("selector").colorbox({ other_key:other_value, open: true});

However, it still binds to events if you were to close the box and try to reopen it.

Upvotes: 4

Related Questions