0
votes

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>
1

1 Answers

5
votes

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.