Lightbox works only after save?

  html, javascript, jquery, lightbox

The lightbox actually works only after I’ve made changes to my html, but not after I refresh the page.
It literally works just the first time after the index.html is save.

I included jQuery before the closing tag and the lightbox.js after it, as suggested in the docs.

<div class="gallery">
            <a href="/pics/1.jpg" data-lightbox="gallery"><img src="/pics/1.jpg" alt=""></a>
            <a href="/pics/Case18nft.png" data-lightbox="gallery"><img src="/pics/Case18nft.png" alt=""></a>
            <a href="/pics/11.jpg" data-lightbox="gallery"><img src="/pics/11.jpg" alt=""></a>
            <a href="/pics/15.jpg" data-lightbox="gallery"><img src="/pics/15.jpg" alt=""></a>
            <a href="/pics/1.jpg" data-lightbox="gallery"><img src="/pics/1.jpg" alt=""></a>
            <a href="/pics/11.jpg" data-lightbox="gallery"><img src="/pics/11.jpg" alt=""></a>
            <a href="/pics/4.jpg" data-lightbox="gallery"><img src="/pics/4.jpg" alt=""></a>
        </div>

        <div class="video">
            <video controls width="1200" src="/pics/movie.mov"></video>
        </div>
    </div>

https://jsfiddle.net/560bm34q/

..I’m new to this and have no idea why it’s acting this way, someone please help..

Source: Ask Javascript Questions

LEAVE A COMMENT