JQuery Colorbox

南笙酒味 提交于 2019-12-24 02:58:32

问题


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/


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/1975170/jquery-colorbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!