Created
February 9, 2015 17:03
-
-
Save dacur/7b6507edc1eac5958f65 to your computer and use it in GitHub Desktop.
Every time a filter is applied/clicked, check to see if any items are displayed on the page. If not, display the message "Your search did not return any results. Please try again.". The message is hidden by default. The searches are fired on the click of a dropdown item. This function is called from each search function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DoesFilterReturnZeroItems(){ | |
var hiddenItems = 0; | |
var allItems = 0; | |
$('#closetItems').find('.closetWrapper').each(function(){ | |
if($(this).hasClass('displaynone')){ | |
hiddenItems++; | |
} | |
allItems++; | |
}); | |
if(allItems==hiddenItems){ | |
$('#noItemsReturnedCloset').removeClass('displaynone'); | |
} else { | |
if(!$('#noItemsReturnedCloset').hasClass('displaynone')){ | |
$('#noItemsReturnedCloset').addClass('displaynone'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment