@yishak621
Posted
Holla miguel good design ...but i don't know why but when i click on the prev & next btn (on mobile) the other images didn't appears its maybe because u didn't store ur local files(images) in a Array Format just like these
const images = [
[
{
src: '/images/image-product-1.jpg',
class: 'img',
id: '1',
alt: 'product-1',
},
{
src: '/images/image-product-2.jpg',
class: 'img',
id: '2',
alt: 'product-2',
},
so the idea is when a user clicks on the prev or next btn use e.target
to detect the specific class list of that btn and add functionality for that btn example
//function for parent container
let count = 0;
this.container.addEventListener('click', function (e) {
const style = e.target.classList;
if (style.contains('prev-mob')) {
count--;
So using the count
u can grab ur images from the Array index
Marked as helpful