But its not the most clever way because i dont know what lightGallery does beside listening to click and touch events to the childs of its container.Ĭonclusion: i think it would be an improvement to add a public function to destroy/remove the full functionality of lightGallery. Workaround: before my filter does anything i remove all click and touch eventlistener from every image in the lightGallery container, i do my filtering and initialize lightGallery again. Try#2: When i initialize lightGallery after my content has changed, it opens on click at images which are "new" and turns black when i click at images which already were there at the first initialisation. Try#1: $("#container").lightGallery("destroy") do my filterings and $("#container").lightGallery() again. 3 comments chris-at-lemon commented on edited sachinchoolur closed this as completed on Sign up for free to join this conversation on GitHub. But image2 does nothing because of the missing eventListener (it was not in the lightGallery container when it gets initialized). When i change the filter to filtertype2 you can see that the first image still opens lightGallery because it is attatched to filtertype1 aswell. The scenario: We start at a page where filtertype1 is active. in this case called "filtertype1", "filtertype2", "filtertype3". To explain: every image can be in multiple categories. It comes with gesture support like pinch for zooming and swipe for navigation. The gallery is fully responsive and highly optimized for touch devices. It also does not have any third-party dependencies to bloat its file size. I use this filter method to prevent loading images again and to be able to add some animations. The lightGallery plugin is a lightweight, JavaScript-based photo and video lightbox gallery plugin. My page is not public yet, so i provide a jsfiddle for you:
0 Comments
Leave a Reply. |