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.67k stars 659 forks source link

stop handles when they side by side #34

Closed srjsrj closed 11 years ago

srjsrj commented 11 years ago

Hello. Very cool plugin btw :+1: I need a feature to stop handles when they are side by side. You can see my solution here: http://srj.im/html/remny/acces.html This one is so buggy. http://jsfiddle.net/AcgfJ/ — call functions.

Is there an another way to solve this? Thanks!

leongersen commented 11 years ago

Interesting question. I'll look in to it today.

chandjitender commented 11 years ago

Hi Well ita a very nice and useful plugin. I have one requirement that the slider handle should not overlap and when they are side by side the value of both handles should be same. Any fix for this?

Thanks Jitender

leongersen commented 11 years ago

I'd say do this by css. Try moving the handles to either sides.

chandjitender commented 11 years ago

Thanks for reply, I have modified your plugin a bit, It will working for me with my requirement handles are not overlapping now and the handle value is same when they are side by side but the problem is it is working fine with value 0 to 100 when I am changing value to some other value then the value are not same when they are side by side.What I did is I made one more helpers name overlap; code demo http://jsbin.com/amorup/2/edit

        overlap:            function(a,b ){
                a/b;
                return a/b;
            },

                                   val1 = api.low ? Math.round(helpers.deScale(api.low.left(), api.options.scale, api.slider.innerWidth())) + Math.round(helpers.overlap(parseFloat($(api.slider).find('.noUi-midBar').css('left')),10)) : false;

                val2    = api.up ? Math.round(helpers.deScale(api.up.left(), api.options.scale, api.slider.innerWidth()))  - Math.round(helpers.overlap(parseFloat($(api.slider).find('.noUi-midBar').css('right')),10)): false;

When I am changing value I will have to change 2nd parameter accordingly. It is set on 10 now. I want to change it dynamically.

Thanks Jitender

chandjitender commented 11 years ago

Hi leongersen, I have figure it out and almost there, your plugin with some modification working fine for me but it differ with value 1 at some point. Can you please look into that issue I am also looking solution for it.

http://www.sendspace.com/file/cmvbfs

chandjitender commented 11 years ago

This is latest code with bug fixed

http://www.sendspace.com/file/zw16aw

leongersen commented 11 years ago

v3 supports a 'margin' option that provides this functionality.

govind999 commented 10 years ago

Hi Leongerson,

What are the options for non-lineaear one? we are using your plugin and don't want both of them overlapping each other,

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.