Question

I use the knob plugin. jsFiddle It worked greatly till I added the following code to change values on hover (line 327):

.bind( "mousemove"
       , function (e) {
           e.preventDefault();
           s._xy()._mouse(e);
         }
)

I need to show this after user clicks (release function) the dial:

<div class="tooltip">Tooltip...</div>

line 673:

$(".dial").knob({
    'release': function ()
    {
        $(".tooltip").slideDown();
        $(".tooltip").delay(1500).slideUp();
    }
});

But it keeps repeating after clicking the dial. Slides down and up every 1,5 sec. I want to stop it from repeating. How to fix it?

Was it helpful?

Solution

You need to add a new handler, _move. Since the behavior of _mouse is for click events.

.bind("mousemove", function (e) {
    e.preventDefault();
    s._xy()._move(e);
})

this._move = function (e) {
    var v = s.xy2val(e.pageX, e.pageY);

    if (v == s.cv)
      return;

    if (s.cH && (s.cH(v) === false))
      return;

    s.change(v);
    s._draw();
};

See it here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top