jQuery UI 是否缺少状态?
jQuery UI 小部件似乎具有非活动、活动和悬停状态,但缺少按下(单击并按住)状态。 这是一个疏忽吗? 我能想到的几乎所有现代 UI 都处于抑郁状态。 有人添加过这样的状态吗? 如果是这样,您必须接触哪些代码?
编辑:我应该说的是悬停和点击状态看起来是一样的。 应该有另一种状态,以便您可以在悬停后看到您已单击。
The jQuery UI widgets seem to have inactive, active, and hover states, but lack a depressed (clicked-and-held) state. Is this an oversight? Just about every modern UI I can think of have a depressed state. Has anyone added such a state? If so, what pieces of code did you have to touch?
Edit: What I should have said is that hovering and clicked states look the same. There should be another state so you can see that you've clicked after hovering.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 HTML/CSS 中,活动状态适用于“当用户激活元素时。例如,在用户按下鼠标按钮和释放鼠标按钮之间”。 (CSS 2.1 部分 5.11.3)如果是按钮,则为按下状态。
我只是假设这也适用于 jQuery UI。
In HTML/CSS, the active state applies "while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it." (CSS 2.1 Section 5.11.3) In the case of buttons, that would be the depressed state.
I just assume that applies to jQuery UI as well.
不要忘记,在 CSS 中,您可以组合伪选择器:
a:active
和a:active:hover
之间有明显的区别:链接可以变成使用键盘按 Tab 键即可激活。 虽然它不是 100% 万无一失,但活动和悬停的状态表明用户已按下该链接。 改变边框样式会给你想要的效果。 唯一的错误是,如果链接变为活动状态,然后用户将鼠标悬停在其上而不单击,它仍然会被抑制。试试这个 CSS 看看我的意思:
Don't forget that in your CSS, you can combine the pseudo-selectors:
There's a definite difference between
a:active
anda:active:hover
: a link can become active by tabbing to it using the keyboard. Though it's not 100% foolproof, the state of being active and hovered would suggest that the user has the link depressed. Altering the border style would give you the desired effect. The only bug in this is if the link becomes active and then the user hovers over it without clicking, it'll still go depressed.Try this CSS to see what I mean:
看来是故意的。 请注意,Themeroller 中有一个可点击:活动状态设置区域,但它的行为并不像 css 活动状态那样。 jQuery UI 1.7 包的快速 grep 显示没有 :active 的样式。 看起来他们设计了 ui 状态来为其小部件提供视觉提示,而将 :active 留给开发人员使用。
It looks to be on purpose. Notice in Themeroller there is a clickable: active state settings area, but it does not behave as the css active state. A quick grep of a jQuery UI 1.7 package shows no styling for :active. It kinda seems like they designed the ui state for visual cues to their widgets, leaving the :active to the developer to use.