How can I autorun photoswipe to show the first picture in the gallery?
<p>I am trying to autorun photoswipe on pages that have a photoswipe gallery on them as soon as the page loads. I have tried two separate solutions, the first one looked something like this:</p>

<pre><code>document.addEventListener('DOMContentLoaded', function(){

    Code.photoSwipe('a', '#Gallery');
    Code.PhotoSwipe.Current.show(0);
}, false);
</code></pre>

<p>I couldn't find the documentation as to where I was supposed to put it, so I simply had that in separate  tags on the pages in question. The second one looked like this.</p>

<pre><code>$(document).on('pagebeforeshow', '#index', function(){   
    var myPhotoSwipe = $(".gallery li a").photoSwipe({
        jQueryMobile: true,
        loop: false,
        enableMouseWheel: false,
        enableKeyboard: false
    });
    myPhotoSwipe.show(0);      
});
</code></pre>

<p>Because the second is jQuery and my friend's site is made with WordPress, I wrapped it and used the appropriate id, but nothing happened. (I also double checked that i was putting the code in the right template actually finding the JS in the source code of the page.) But yeah still nothing.</p>

<p>If anyone could help me out they would literally save me hours of headache (and possibly my life) as I promised my friend that I would be able to do this. </p>