4,396
edits
No edit summary |
No edit summary |
||
Line 122: | Line 122: | ||
event.stopPropagation(); | event.stopPropagation(); | ||
}); | }); | ||
function setupImageToggle(images) { | function setupImageToggle(images) { | ||
var currentIndex = 0; | var currentIndex = 0; | ||
var totalImages = images.length; | var totalImages = images.length; | ||
function toggleImage() { | function toggleImage() { | ||
currentIndex = (currentIndex + 1) % totalImages; | currentIndex = (currentIndex + 1) % totalImages; | ||
Line 133: | Line 133: | ||
$('#article-content').find('.article-images').html(getImageHtml(image, currentIndex, totalImages)); | $('#article-content').find('.article-images').html(getImageHtml(image, currentIndex, totalImages)); | ||
} | } | ||
// | // Updated event binding | ||
$('#article-content').on('click', '. | $('#article-content').on('click', '.image-container img', function () { | ||
console.log("Image clicked"); | |||
toggleImage(); | toggleImage(); | ||
}); | }); | ||
} | } | ||
function getImageHtml(image, currentIndex, totalImages) { | function getImageHtml(image, currentIndex, totalImages) { | ||
var imageLabel = (currentIndex + 1) + '/' + totalImages + ' IMAGES'; | var imageLabel = (currentIndex + 1) + '/' + totalImages + ' IMAGES'; | ||
Line 148: | Line 148: | ||
'<div class="' + image.captionClass + '">' + image.caption + '</div>' + | '<div class="' + image.captionClass + '">' + image.caption + '</div>' + | ||
'</div>'; | '</div>'; | ||
} | } | ||
// Attach a mousedown event listener to close the fixed column | // Attach a mousedown event listener to close the fixed column |