Skip to content

Commit

Permalink
Use 'ch' units for determining the width of the facet counts
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Aug 15, 2017
1 parent fc04018 commit 3ee8b69
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/assets/javascripts/blacklight/facet_load.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
function longer (a,b){ return b.textContent.length - a.textContent.length; }

$('ul.facet-values, ul.pivot-facet').each(function(){
var longest = $(this).find('span.facet-count').sort(longer).first();
var clone = longest.clone()
.css('visibility','hidden').css('width', 'auto');
$('body').append(clone);
$(this).find('.facet-count').first().width(clone.width());
clone.remove();
var longest = $(this).find('span.facet-count').sort(longer)[0];

if (longest && longest.textContent) {
var width = longest.textContent.length + 1 + 'ch';
$(this).find('.facet-count').first().width(width);
}
});
};

Expand Down

0 comments on commit 3ee8b69

Please sign in to comment.