views:

677

answers:

3
+2  Q: 

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/

A: 

You should use the load event of the page, because at some moment the js file with color box wouldn't be loaded to the client, and this will cause the js error, and after this your code will be broken.

VMAtm
+2  A: 

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.

Doug Neiner
A: 

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).

Eduardo