Skip to content

Commit

Permalink
added is-empty class
Browse files Browse the repository at this point in the history
  • Loading branch information
smohadjer committed Mar 20, 2017
1 parent 78b4c0f commit e13de3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
});
});
</script>
<style>
ul + p {
display: none;
}

ul.is-empty + p {
display: block;
}
</style>
</head>
<body>
<label>Filter by continent:</label>
Expand Down Expand Up @@ -71,5 +80,6 @@ <h2>Countries:</h2>
<li data-filter-continent="sa">Chile</li>
<li data-filter-continent="sa">Uruguay</li>
</ul>
<p>No results found!</p>
</body>
</html>
5 changes: 4 additions & 1 deletion jquery.filterList.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @name filterList
* @version 2.0.0
* @version 2.0.1
* @lastmodified 2017-03-20
* @author Saeid Mohadjer
*
Expand Down Expand Up @@ -268,7 +268,10 @@
$(matchedItems).each(function() {
$(this).show();
});
pluginInstance.$element.removeClass('is-empty');
$listItems.filter(':visible').last().addClass('last-visible');
} else {
pluginInstance.$element.addClass('is-empty');
}

pluginInstance.options.filtersCallback(pluginInstance);
Expand Down

0 comments on commit e13de3a

Please sign in to comment.