How to make a jquery lightbox open multiple images from one link?

后端 未结 5 1876
傲寒
傲寒 2021-02-03 11:50

Using a lightbox like ColorBox or jQuery Lightbox Plugin how can i make a single link which opens a gallery / array of images?

For example i have 1 thumbnail and when a

5条回答
  •  臣服心动
    2021-02-03 12:20

    Here is the proper (and more efficient) solution:

    HTML:

    
    

    jQuery/JS:

    $(document).ready(function() {
        $('#gallery a').lightBox();
    });
    

    Note: As you can see, simply list the anchor links to the other images you want to be apart of the gallery. No need to add images to the markup and then hide them with JS. The only image you will see in the markup example above is images/thumbnail-image1.jpg Lightbox will automatically hide the rest of them and then show each one at the appropriate time.

提交回复
热议问题