Skip to content

Commit 39c2fd1

Browse files
author
Valentin Hervieu
committed
Fix ticks count when step is a float.
1 parent af766f4 commit 39c2fd1

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

dist/rzslider.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,10 @@ function throttle(func, wait, options) {
669669
if(!this.showTicks) return;
670670
if(!this.step) return; //if step is 0, the following loop will be endless.
671671

672-
var positions = '';
673-
for (var i = this.minValue; i <= this.maxValue; i += this.step) {
674-
var selectedClass = this.isTickSelected(i) ? 'selected': false;
672+
var positions = '',
673+
ticksCount = Math.round((this.maxValue - this.minValue) / this.step) + 1;
674+
for (var i = 0; i < ticksCount; i++) {
675+
var selectedClass = this.isTickSelected(i) ? 'selected': '';
675676
positions += '<li class="tick '+ selectedClass +'">';
676677
if(this.showTicksValue)
677678
positions += '<span class="tick-value">'+ this.getDisplayValue(i) +'</span>';

0 commit comments

Comments
 (0)