4,554
edits
No edit summary |
No edit summary |
||
Line 153: | Line 153: | ||
// Function to open the modal and adjust the list | // Function to open the modal and adjust the list | ||
function openModal(cardElement) { | function openModal(cardElement, event) { | ||
event.stopPropagation(); // Prevent the event from bubbling up | |||
console.log('openModal called with:', cardElement); | console.log('openModal called with:', cardElement); | ||
var isRelatedArticle = $(cardElement).hasClass('related-article'); | var isRelatedArticle = $(cardElement).hasClass('related-article'); | ||
Line 356: | Line 357: | ||
// Delegate the mousedown event for both block view and list view pages | // Delegate the mousedown event for both block view and list view pages | ||
$('#list, #list-list').on('mousedown', '.card, .list-card', function (event) { | $('#list, #list-list').on('mousedown', '.card, .list-card', function(event) { | ||
if ($(event.target).closest('.people a, .type a').length) { | if ($(event.target).closest('.people a, .type a').length) { | ||
return; // Clicked on a link inside '.people' or '.type', do nothing | return; // Clicked on a link inside '.people' or '.type', do nothing | ||
} | } | ||
openModal(this); | openModal(this, event); // Pass the event object to openModal | ||
}); | }); | ||
function setupImageToggle(images) { | function setupImageToggle(images) { |