开发者

Open pirobox lightbox on load instead of click

开发者 https://www.devze.com 2023-03-16 14:07 出处:网络
I开发者_C百科 need help in opening a pirobox lightbox on a page load instead of clicking on it. http://www.pirolab.it/pirobox/index.phpPirobox doesn\'t support this explicitly, but you can programmat

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

精彩评论

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