jQuery UI — buttonset buttons don't always work on first click

后端 未结 2 889
不思量自难忘°
不思量自难忘° 2021-02-19 22:18

I am using a jQuery UI buttonset (based on a few radio buttons.) Everything works pretty fine except sometimes when you click on one of the buttons nothing happens (just as if y

相关标签:
2条回答
  • 2021-02-19 22:35

    This happens for me too.

    I think the problem is that you have to hold your mouse still when clicking the button, or it will not work.

    For example, try clicking the button while moving your mouse at a slow, steady pace. The button won't work unless the mouse is barely moving. Also try dragging the button even just one pixel, then releasing.

    The site you came across that works seems to use mousedown to avoid this problem. They are also using an older version of jQuery UI, which might be a factor.

    0 讨论(0)
  • 2021-02-19 22:45
     $( "#radio" ).buttonset();
     $( "#radio" ).find("label").unbind("mouseup");
    

    because in jquery source code there is:

    .bind( "mouseup" + this.eventNamespace, function( event ) {
      if ( options.disabled ) {return; }
      if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
                        clickDragged = true;
       }
    }
    
    0 讨论(0)
提交回复
热议问题