MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 469: Line 469:
});
});


     // Alternative way to Close modal and remove fade out when clicking outside of card
/*     // Alternative way to Close modal and remove fade out when clicking outside of card
$(document).on('mousedown', function (event) {
$(document).on('mousedown', function (event) {
    var isOutsideWrapper = !showArticleWrapper.is(event.target) && showArticleWrapper.has(event.target).length === 0;
    var isOutsideWrapper = !showArticleWrapper.is(event.target) && showArticleWrapper.has(event.target).length === 0;
Line 479: Line 479:
        showArticleWrapper.css('display', 'none');
        showArticleWrapper.css('display', 'none');
    }  
    }  
});
}); */
 
/*
     // Revert changes when clicking outside the modal
     // Revert changes when clicking outside the modal
     $(document).on('mousedown', function(event) {
     $(document).on('mousedown', function(event) {
Line 487: Line 487:
             console.log('Closing modal');
             console.log('Closing modal');
    }
    }
});
}); */
 
    // Using delegated event handling for clicks outside the modal
    $(document).on('mousedown', function (event) {
        var isOutsideWrapper = !showArticleWrapper.is(event.target) && showArticleWrapper.has(event.target).length === 0;
        var isOnCard = $(event.target).closest('.card, .list-card').length > 0;
       
        if (isOutsideWrapper && !isOnCard) {
            console.log('Closing modal from outside wrapper and not on card');
            closeModal();  // Use closeModal() for consistent cleanup
        }
    });
 


     // Hover effect for scrolling
     // Hover effect for scrolling

Navigation menu