I discovered the amazing combination of using lightGallery along with the cycle2 plugin. My images are categorized, and I would like them to dynamically change when a category is clicked. Can anyone provide an example on how to achieve this?
The categories for my images are denoted by a[data-id]
, which represent the image parents, and li#id
represents the category names.
Below is the code structure that I am working with:
$(document).ready(function() {
$('.mySlideShow').cycle({
pauseOnHover: true,
pager: "#single-pager",
log:false,
pagerTemplate: "<img src='{{src}}' width=48 height=48>",
slides: ">a"
});
$(".mySlideShow").lightGallery({
exThumbImage: "data-exthumbimage",
download: false,
thumbnail: true,
loadYoutubeThumbnail: true,
youtubeThumbSize: 'default',
loadVimeoThumbnail: true,
vimeoThumbSize: 'thumbnail_medium',
});
})
.single-gallery {
position: relative;
width: 900px;
}
.mySlideShow {
height: 494px;
background: #000;
overflow: hidden;
}
#single-pager img {
width: 49.3px;
border: 1px solid #fff;
cursor: pointer;
margin: 2px;
}
.gallery-categories {
position: absolute;
z-index: 20000;
left: 0;
top: 10%;
list-style: none;
padding: 0;
}
h1 {
color: #FFF;
padding: 0;
margin: 0;
font-size: 16px;
text-align: center;
}
.gallery-categories li {
background: rgba(0, 0, 0, 0.5);
color: #fff;
font-weight: bold;
padding: 4px;
margin: 2px;
display: inline-block;
cursor: pointer;
}
<link href="https://cdn.jsdelivr.net/lightgallery/latest/css/lightgallery.css" rel="stylesheet" />
<div class="single-gallery" id="single-gallery">
<div class="single-gallery-carousel">
<div class="slideshow-area">
<div class="mySlideShow">
<a data-src="https://sachinchoolur.github.io/lightGallery/static/img/11.jpg" data-exthumbimage="https://sach...