4,554
edits
No edit summary |
No edit summary |
||
Line 34: | Line 34: | ||
} | } | ||
// Using delegated event handling | // Using delegated event handling for both #list and #list-list | ||
$('#list').on('mousedown', '.filtered-value-option', function (event) { | $('#list, #list-list').on('mousedown', '.filtered-value-option', function(event) { | ||
console.log("Filter clicked"); | console.log("Filter clicked"); | ||
communityFeatured.hide(); | |||
// Check if the event occurred within #list or #list-list | |||
if ($(this).closest('#list').length) { | |||
// If inside #list | |||
communityFeatured.hide(); | |||
console.log("Community Featured should now be hidden"); | |||
} else if ($(this).closest('#list-list').length) { | |||
// If inside #list-list | |||
communityListFeatured.hide(); | |||
console.log("Community List Featured should now be hidden"); | |||
} | |||
}); | }); | ||