Fixed the slider mouse down listener
This commit is contained in:
parent
76cd711f67
commit
84face7e3b
1 changed files with 1 additions and 1 deletions
|
@ -73,7 +73,7 @@ export function sliderfy(slider: JQuery, options?: SliderOptions) : Slider {
|
|||
const parent_offset = slider.offset();
|
||||
const min = parent_offset.left;
|
||||
const max = parent_offset.left + slider.width();
|
||||
const current = 'touches' in event ? event.touches[event.touches.length - 1].clientX : event.pageX;
|
||||
const current = ('touches' in event && Array.isArray(event.touches) && event.touches.length > 0) ? event.touches[event.touches.length - 1].clientX : (event as MouseEvent).pageX;
|
||||
|
||||
const range = options.max_value - options.min_value;
|
||||
const offset = Math.round(((current - min) * (range / options.step)) / (max - min)) * options.step;
|
||||
|
|
Loading…
Add table
Reference in a new issue