leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.64k stars 658 forks source link

Is there a way to return the new slider value on mouseover? #1187

Closed bitowaqr closed 2 years ago

bitowaqr commented 2 years ago

I'd like to programmatically create a new handle when the cursor is moved over the slider, as if it was clicked at that position. Is there a way to get the position of the new handle position?

leongersen commented 2 years ago

Yes, you can enable the hover behaviour.

bitowaqr commented 2 years ago

Ah, so easy! Can this work with 'dragover' as well?

leongersen commented 2 years ago

I'm not sure what you mean, could you elaborate?

bitowaqr commented 2 years ago

Sorry, what I would like to do is to put a handle-like element somewhere on the page and the user should then be able to drag the handle-element on to the slider. My idea was to remove the handle-like element once the cursor reaches the slider and create a proper handle on the slider at the cursor position – I hope this makes sense?

I guess the problem is, the cursor is dragging an element, so it doesn't trigger the hover event. Is there an easy fix for this?

bitowaqr commented 2 years ago

Never mind, I figured something out myself, and it's probably not a functionality many people would want to use.

https://github.com/bitowaqr/dragon-noUiSlider

Thanks anyway.

leongersen commented 2 years ago

That's pretty cool, thanks for sharing the demo!

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.