Search code examples
javascriptphplightboxlightbox2

Lightbox showing a reload box on loading the page


I am trying to use lightbox function for a gallery page, on 1st load the page is working fine, but on 2nd load, i.e. if I enter the gallery page from any other page 2nd time onwards a white box with a loading symbol is showing, which goes off if I reload the page, but stays if I do not refresh. It stays even if I visit the page from any page of my website.

http://postimg.org/image/41q5mcxfd/

http://postimg.org/image/jhmuyq9gx/

Please check the screen shot

lightbox script I am using is:

<script src="js/lightbox.js"></script>
<a class="example-image-link" href="../img/<?php echo $image; ?>" data-lightbox="example-set" ><img class="sample" src="../img/<?php echo $image; ?>" alt=""/></a>

Solution

  • Found solution,

    $(document).ready(function(){
    
            $(".lightbox").each(function(){
                if($(this).css('display') == "block"){
                    $(this).hide();
                }
            });
    });