0

html code:

<a id="image1" href="images/1.jpg" class="swipebox" title="My Caption">
    <img src="images/1mini.jpg" alt="image" />
</a>

Js code for firing the pugin when user enters with link that ends with '#1'

<script type="text/javascript">
    $(document).ready(function(){
        if(window.location.hash == "#1") {
            $( '#image1' ).swipebox();
        }
    });
</script>

I figured it out that the js code

$( '#image1' ).swipebox();

works only when I click on the image. But I need that during the page load it would be popuped already.

vijayP
  • 11,262
  • 5
  • 21
  • 37

1 Answers1

1

To open the swipebox on page load; could you please try with following code:

<script type="text/javascript">
    $(document).ready(function(){
        if(window.location.hash == "#1") {
            $( '#image1' ).swipebox();
            $( '#image1' ).click();//click the image programmatically
        }
    });
</script>
vijayP
  • 11,262
  • 5
  • 21
  • 37