jQuery UI-按钮集按钮并非总是在首次单击时起作用 [英] jQuery UI -- buttonset buttons don't always work on first click

查看:72
本文介绍了jQuery UI-按钮集按钮并非总是在首次单击时起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery UI按钮集(基于一些单选按钮.)一切正常,除了有时单击按钮之一时什么都没有发生(就像您从未单击过按钮一样).我以为可能是实施方面的问题,所以我去了演示站点:

http://jqueryui.com/demos/button/#radio

花了一些时间在不同的选择之间切换.我有同样的问题!随机单击将被忽略!

我遇到了这个网站:

http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/

哪个版本推出了自己的版本,但我无法复制相同的问题.这使我相信jQuery UI实现会有一些小怪癖?

有人看过吗?我花了一些时间试图找到其他人也有同样的问题,却没有提到它.还有其他人看到相同的问题吗?

解决方案

这对我也是一样.

我认为问题在于单击该按钮时必须将鼠标保持不动,否则将无法工作.

例如,尝试以缓慢,稳定的速度移动鼠标时单击该按钮.除非鼠标几乎不动,否则该按钮将不起作用.另外,请尝试将按钮拖至仅一个像素,然后松开.

您遇到的有效站点似乎使用mousedown来避免此问题.他们还使用了较旧版本的jQuery UI,这可能是一个因素.

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 you had never clicked it at all). I thought perhaps it was perhaps a problem with my implementation so I went to the demo site:

http://jqueryui.com/demos/button/#radio

And spent some time clicking around flipping between the different choices. I had the same problem! Randomly the click would be ignored!

I came across this site:

http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/

Which rolled their own version and I was unable to replicate the same issue. Which leads me to believe that there is some minor quirk with the jQuery UI implementation?

Has anyone seen this? I spent some time trying to find others having the same problem and haven't found any mention of it. Does anyone else see the same issue?

解决方案

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.

这篇关于jQuery UI-按钮集按钮并非总是在首次单击时起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆