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>
精彩评论