miromannino / Justified-Gallery

Javascript library to help creating high quality justified galleries of images. Used by thousands of websites as well as the photography community 500px.
http://miromannino.github.io/Justified-Gallery/
MIT License
1.69k stars 299 forks source link

Endless scroll with fancybox #204

Open sebamsg opened 7 years ago

sebamsg commented 7 years ago

Hi guys, im trying to make and endless scroll but i cant lightbox the new images that loads the endless scroll. Im using fancybox to open the images.

my HTML code is:

> <div id="mygallery" class="justified-gallery ">
>     <a href="..dist/img/reg (53).jpg"  rel="ligthbox" class="jg-entry entry-visible fancybox ">
>         <img alt="" src="dist/img/reg (53)a.jpg" />
>     </a>
>     <a href="http://mdbootstravp.com/images/reg/reg (54).jpg" rel="ligthbox" class="fancybox">
>         <img alt="" src="dist/img/reg (53)b.jpg" />
>     </a>

and script that loads is:

> <script> $(window).scroll(function() {
>     if($(window).scrollTop() + $(window).height() == $(document).height()) {
>       for (var i = 0; i < 2; i++) {
>         $("#mygallery").append('<a href="http://mdbootstrap.com/images/reg/reg (51).jpg" rel="ligthbox" class="fancybox">' +  '<img alt="" src="dist/img/reg (53)g.jpg" />' +   '</a>');
>       }
>       $("#mygallery").justifiedGallery("norewind");
>     }
>   });
>     </script>

Thanks in advanced!! Seba.