Open jQuery Colorbox onLoad
Update – 26th December 2010 (Credit to azrad)
Since writing this post it seems that ColorBox has been updated meaning the solution below is now longer needed. Simply using the latest version of colorbox will allow you to open the ColorBox onLoad.
I came across a scenario today where I needed to open the jQuery ColorBox as soon as the page loaded. After looking on the ColorBox website it read as follows:
And it can be called directly, without assignment to an element
After attempting to add the above code to the how to make an app onload event of the page nothing happened. No ColorBox, no errors, nothing. After a short while spent researching it appears that there is an extra parameter required called ‘open’ that, if set to TRUE, results in the ColorBox opening automatically with no input from the user. The resulting, and functioning, code now looked as follows: