jQuery UI的切换按钮(复选框),然后单击/拖动的bug [英] Jquery UI toggle button (checkbox) click/drag bug
问题描述
我的最佳答案我想出了一起发布此。我还没有发现任何类似的问题,所以这里去。
I'm posting this along with the best answer I have come up with. I haven't found any similar questions, so here goes.
在类型复选框的输入转换为jQuery UI的按钮,我观察(如具有的其他中)如果鼠标保持完全静止,同时点击,它只是记录一次点击。任何运动是什么那么以往任何时候都没有任何反应。对于用户来说,这只能理解为片状和不可靠的行为。
When a input of type checkbox is converted to a jquery ui button, I have observed (as have others) that it only registers a click if the mouse is kept completely still while clicking. Any movement what-so-ever and nothing happens. To the user this can only be perceived as flaky and unreliable behavior.
如何他人解决此问题(在Chrome 14使用jQuery 1.6.3 / jQuery UI的16年1月8日观察和IE 8)?有什么明显的我失踪,因为我得去这样的长度,以获得预期的行为?
How do others work around this behavior (observed with jquery 1.6.3/jquery ui 1.8.16 in chrome 14 and ie 8)? Is there something obvious I am missing since I have to go to such lengths to get the expected behavior?
推荐答案
我得到了从jQuery UI页面上的问题,报告此解决方法的想法联系到上面,但它需要一些工作:的jsfiddle
I got the idea for this workaround from an issue report on the jquery ui page linked to above, but it needed a bit of work: jsfiddle
我附上标签上点击监听器和处理状态而改变自己。我也认为有必要对切换按钮prevent文本选择。这是用CSS做(发现其他地方SO)
I attach a click listener on the label and handle the state change myself. I also found it necessary to prevent text selection on the toggle button. This is done with css (found that elsewhere on SO)
.unselectable {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}
这也许可以保存想要使用jQuery UI的切换按钮一些时间和悲痛下一个人。如果有人有一个更好/更清洁的解决方案,我很感兴趣!
Maybe this can save the next person that wants to use the jquery ui toggle button some time and grief. If anybody has a better/cleaner solution, I am very interested!
这篇关于jQuery UI的切换按钮(复选框),然后单击/拖动的bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!