Skip to content

Commit

Permalink
cache .slider-markers selector as per suggestion by @tomgreenfield
Browse files Browse the repository at this point in the history
  • Loading branch information
moloko committed Feb 27, 2017
1 parent 76ee7a4 commit 7b6d36f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js/adapt-contrib-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,14 @@ define([
},

showScale: function () {
this.$('.slider-markers').empty();
var $markers = this.$('.slider-markers').empty();
if (this.model.get('_showScale') === false) {
this.$('.slider-markers').eq(0).css({display: 'none'});
$markers.eq(0).css({display: 'none'});
this.$('.slider-scale-numbers').eq(0).css(
this.model.get('_showScaleIndicator') ? {visibility: 'hidden'} : {display: 'none'}
);
} else {
var $scaler = this.$('.slider-scaler');
var $markers = this.$('.slider-markers');
for (var i = 0, count = this.model.get('_items').length; i < count; i++) {
$markers.append("<div class='slider-line component-item-color'>");
$markers.find('.slider-line').eq(i).css({left: this.mapIndexToPixels(i, $scaler) + 'px'});
Expand Down

0 comments on commit 7b6d36f

Please sign in to comment.