Giter Site home page Giter Site logo

Comments (4)

drgould avatar drgould commented on July 16, 2024

This is expected behavior. When the knobs overlap, because the slider is unaware of the UI, it can only guess which knob the user intends to move (telekinesis is coming in a future update ;) ). The only reliable thing to do is move them both. It could be more granular about checking the exact pixel where the click starts but I feel that might lead to some bad UX.

In the case of your linked demo, the inactive image you're using for the knobs has a bunch of padding which causes it to not look overlapped to the user, but in the DOM they actually are. Using active and inactive images that are the same width should help with that. Another option would be to set a buffer so the knobs don't overlap.

I'll leave this open for more feedback but for now I'm leaving it as is.

from angular-slider.

borgateo avatar borgateo commented on July 16, 2024

@drgould That example works quite alright, but if I try to use the last version of angular-slider.js, there are some issues with the knobs. They don't move properly.

(ofc I changed ng-model-low to ng-model and ng-model-high to ng-model-range)

from angular-slider.

Vitenok avatar Vitenok commented on July 16, 2024

A little hack which can help here.
When both knobs are overlapped, if user is trying to select one knob the value of ref variable in onMove function is 'selectBar', So I added this piece of code (pseudocode):

onMove(){
......
if(isDualKnob) {
// dual knob slider
if (ref === 'selectBar' ){
ref = 'ngModelHigh';
}
......
}
}
So when selection is undefined right knob will be returned.
Quite primitive, but works.
P.S. I also used older version of angular-slider.js, due to its' better performance.

from angular-slider.

trygveaa avatar trygveaa commented on July 16, 2024

The problem with moving both sliders is that it makes it impossible to separate them, as far as I can see. So if you move them so they overlap, you are unable to move them where you want afterwards. How is a user supposed to solve this?

If you only move one of them, this is not a problem. Even if you move the one the user didn't intend to move, he will still be able to move them to the intended locations since they now are separated.

from angular-slider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.