From 7b6d36f0a787cc8936c9038c09184e2f25081c79 Mon Sep 17 00:00:00 2001 From: moloko Date: Mon, 27 Feb 2017 17:07:26 +0000 Subject: [PATCH] cache .slider-markers selector as per suggestion by @tomgreenfield --- js/adapt-contrib-slider.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/adapt-contrib-slider.js b/js/adapt-contrib-slider.js index 2b99849..a6fffd7 100644 --- a/js/adapt-contrib-slider.js +++ b/js/adapt-contrib-slider.js @@ -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("
"); $markers.find('.slider-line').eq(i).css({left: this.mapIndexToPixels(i, $scaler) + 'px'});