Commit 3f08741e authored by b_sharpe's avatar b_sharpe Committed by StryKaizer

Issue #2910421 by gauravjeet, b_sharpe: If same facet is used more than once...

Issue #2910421 by gauravjeet, b_sharpe: If same facet is used more than once on a page - soft limit does not work correctly
parent cb9f66dc
......@@ -33,8 +33,18 @@
var zero_based_limit = (limit - 1);
var facetsList = $('ul[data-drupal-facet-id="' + facet + '"]');
// In case of multiple instances of a facet, we need to key them.
if (facetsList.length > 1) {
facetsList.each(function (key, $value) {
var $facet_id = $(this).attr('data-drupal-facet-id');
$(this).attr('data-drupal-facet-id', $facet_id + '-' + key);
});
}
// Hide facets over the limit.
facetsList.children('li:gt(' + zero_based_limit + ')').once().hide();
facetsList.each(function() {
$(this).children('li:gt(' + zero_based_limit + ')').once().hide();
});
// Add "Show more" / "Show less" links.
facetsList.once().filter(function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment