Skip to content

Commit

Permalink
Add selection CSS classes to tick labels
Browse files Browse the repository at this point in the history
Make code compliant with linters
  • Loading branch information
duggi committed May 29, 2017
1 parent e55e01a commit 9d9c0d1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/js/bootstrap-slider.js
Expand Up @@ -1314,6 +1314,24 @@ const windowIsDefined = (typeof window === "object");
}
this.tickLabelContainer.style[styleMargin] = this.sliderElem.offsetWidth / 2 * -1 + 'px';
}

/* Set class labels to indicate tick labels are in the selection or selected */
this._removeClass(this.tickLabels[i], 'label-in-selection label-is-selection');
if (!this.options.range) {
if (this.options.selection === 'after' && percentage >= positionPercentages[0]) {
this._addClass(this.tickLabels[i], 'label-in-selection');
} else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
this._addClass(this.tickLabels[i], 'label-in-selection');
}
if (percentage === positionPercentages[0]) {
this._addClass(this.tickLabels[i], 'label-is-selection');
}
} else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) {
this._addClass(this.tickLabels[i], 'label-in-selection');
if (percentage === positionPercentages[0] || positionPercentages[1]) {
this._addClass(this.tickLabels[i], 'label-is-selection');
}
}
}
}
}
Expand Down

0 comments on commit 9d9c0d1

Please sign in to comment.