single product visiblity? version

This commit is contained in:
nomadics9 2025-04-03 17:55:21 +03:00
parent 2ae7ed10ad
commit ce7b4a4b2b

View file

@ -1,28 +1,28 @@
//jQuery(document).ready(function ($) {
// $('.product-image-slider').each(function () {
// let slider = $(this);
// let items = slider.find('.slider-item');
// let currentIndex = 0;
//
// function showSlide(index) {
// items.removeClass('active');
// $(items[index]).addClass('active');
// }
//
// slider.siblings('.slider-prev').click(function () {
// currentIndex = (currentIndex > 0) ? currentIndex - 1 : items.length - 1;
// showSlide(currentIndex);
// });
//
// slider.siblings('.slider-next').click(function () {
// currentIndex = (currentIndex < items.length - 1) ? currentIndex + 1 : 0;
// showSlide(currentIndex);
// });
//
// // Initialize
// showSlide(currentIndex);
// });
//});
jQuery(document).ready(function($) {
$('.product-image-slider').each(function() {
let slider = $(this);
let items = slider.find('.slider-item');
let currentIndex = 0;
function showSlide(index) {
items.removeClass('active');
$(items[index]).addClass('active');
}
slider.siblings('.slider-prev').click(function() {
currentIndex = (currentIndex > 0) ? currentIndex - 1 : items.length - 1;
showSlide(currentIndex);
});
slider.siblings('.slider-next').click(function() {
currentIndex = (currentIndex < items.length - 1) ? currentIndex + 1 : 0;
showSlide(currentIndex);
});
// Initialize
showSlide(currentIndex);
});
});
//
//
//