开发者

Open pirobox lightbox on load instead of click

I开发者_C百科 need help in opening a pirobox lightbox on a page load instead of clicking on it.

http://www.pirolab.it/pirobox/index.php


Pirobox doesn't support this explicitly, but you can programmatically trigger a "fake" click onLoad.

For example:

<script type="text/javascript">
$(function() {
   $('#myId').click();
});
</script>

<body>
    <a href="big1.jpg" rel="single" class="pirobox" title="your title" id="myId">
        <img src="small1.jpg"  />
    </a>
</body>

Here's a fixed version of your original approach (though I do not recommend using inline Javascript like this!):

<script type="text/javascript">
function open_popup() {
   $('#myId').click();
}
</script>

<body onload="open_popup()">
    <a href="big1.jpg" rel="single" class="pirobox" title="your title" id="myId">
       <img src="small1.jpg"  />
    </a>
</body>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜