document.addEventListener('DOMContentLoaded', function() {
const galleryContainer = document.querySelector('.my-gallery');
const galleryImages = galleryContainer.querySelectorAll('.bricks-layout-item');
let currentImageIndex = 0;
// Hide all images except the first one
galleryImages.forEach((img, index) => {
if (index !== 0) img.style.display = 'none';
});
// Function to update image visibility
function updateImage(newIndex) {
galleryImages[currentImageIndex].style.display = 'none';
currentImageIndex = newIndex;
galleryImages[currentImageIndex].style.display = 'block';
}
// Next button functionality
document.getElementById('next-button').addEventListener('click', function() {
const newIndex = (currentImageIndex + 1) % galleryImages.length;
updateImage(newIndex);
});
// Previous button functionality
document.getElementById('prev-button').addEventListener('click', function() {
const newIndex = (currentImageIndex - 1 + galleryImages.length) % galleryImages.length;
updateImage(newIndex);
});
});




