Jquery Super box automatically loads
The superbox is a jquery plugin that has lightbox effect. My problem is how can I change this thing instead of click, it will automatically loads when the page is executed. The code rel in <a> is required. How can I set that to onload or automatically popup when I visit the page.
My Code:<link rel="stylesheet" href="css/jquery.superbox.css" type="text/css" media="all" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery-superbox-0.9.1/jquery.superbox.js"></script> <script type="text/javascript"开发者_开发问答> $(function(){ $.superbox(); }); </script> <a href="forgotpass.php" class="text-links" rel="superbox[iframe]">Click here.</a>
Unless you want to mess around with the plugin code, you could invoke the link click event, not pretty but it'll work.
<link rel="stylesheet" href="css/jquery.superbox.css" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-superbox-0.9.1/jquery.superbox.js"></script>
<script type="text/javascript">
$(function(){
$.superbox();
$('#lightbox_click').trigger('click');
});
</script>
<a href="forgotpass.php" id="lightbox_click" class="text-links" rel="superbox[iframe]">Click here.</a>
Note that the link is now using an ID, you'd only want to target a single link, and that's what we're doing with the $('#lightbox_click').trigger('click');
code.
精彩评论