没有 JavaScript 的 jqueryui
有人在不使用 jQuery 组件的情况下使用 jQueryUI(例如 CSS 框架部分)吗?如果您正在为没有 javascript 或禁用了 javascript 等的用户提供服务,那么
一个特定的场景是对话框,它们非常出色且简单...没有 javascript 它只是一个 div...一个潜在的解决方案是让对话框 div 带有一个类,将其绝对定位在其他元素之上,然后在 jQueryUI 设置对话框时删除该类...这样,如果 javascript 无法运行,对话框仍然具有该类?
或者您会使用 css 框架手动创建对话框吗...
Does anyone use jQueryUI (such as the CSS framework part) without the jQuery component? If you were catering for users who don't have javascript or who have it disabled etc
A particular scenario would be the dialogs which are so brilliant and simple...without javascript its just a div though...would a potential solution be to have the dialog div with a class that positions it absolutely and above other elements and then to remove that class when jQueryUI sets up the dialog...so that if javascript cannot run the dialog still has the class?
or would you use the css framework to create the dialog manually perhaps...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当 JavaScript 关闭时,我使用 jQuery UI 的类来“一致”地设置样式。您只需使用 jQuery UI 应用于元素的类,并包含 jQuery UI 样式表和资源。
例如,如果您
运行了 jQuery UI JavaScript:
它会将标记更改为:
为您提供一个漂亮的 jQuery UI 按钮。但只有在 JavaScript 运行后才会应用它。如果用户没有/不允许使用 JavaScript,那么您将得到一个丑陋的链接。相反,您应该在一开始就使用 jQuery UI 类:
在 JavaScript 运行之前它将具有基本的 jQuery UI 样式(尽管结构不同 - 跨度不存在,如果您最初有跨度,它会添加另一个跨度)无论如何,恕我直言,这是一个错误)。问题是你希望 JavaScript 仍然运行,因为它添加了其他东西,例如鼠标悬停效果(以及前面提到的跨度),以便拥有 JavaScript 的用户获得完整的体验,但你也想使用 jQuery UI默认情况下,类是因为您想要一些一致的主题(即使它不是 100% 完美)。
有关 CSS 框架的更多信息,请查看 http://jqueryui.com/docs/Theming/API。
如果你想让它不使用 JavaScript,你必须有:
它很丑陋,但是如果没有脚本你就无法实现动态 HTML,对吧......
I have used jQuery UI's classes to style things 'consistently' when JavaScript is turned off. You just use the classes that jQuery UI applies to elements, and include the jQuery UI stylesheet and resources.
For example, if you had
And you ran the jQuery UI JavaScript:
It would alter the markup to:
Giving you a nice jQuery UI button. But only once the JavaScript has run will this be applied. If a user doesn't have/allow JavaScript, then you'll get an ugly link being used. Instead, you should use the jQuery UI classes at the start:
It will have the basic jQuery UI styling before the JavaScript runs (the structure is different though - the span isn't there, and if you had the span initially it adds another one anyway, which IMHO is a bug). The thing is that you want the JavaScript to run still, because it adds other things, such as mouseover effects (and the span mentioned earler), so that users that DO have JavaScript get the full experience, but you also want to use jQuery UI classes by default because you want some consistent theme (even if it's not 100% perfect).
For more info about their CSS framework, check out http://jqueryui.com/docs/Theming/API.
If you want to have it to NOT use JavaScript, you'd have to have:
It is ugly, but you can't do dynamic HTML without scripting, right...
我一直在 jQueryUI 之外使用 CSS;我发现它提供了更加一致的外观和感觉。
至于剩下的问题……什么?!
您打算如何在不启用 JavaScript 的情况下运行 jQueryUI(“设置对话框”)?如果您在没有 JavaScript 的情况下打开对话框,它将无法移动或关闭;你会被困在屏幕中间一个巨大的
div
中。I use the CSS all the time outside of jQueryUI; I find it provides a much more consistent look-and-feel.
As for the rest of the question...whatt?!
How do you plan on having jQueryUI run ("set up the dialog") without JavaScript being enabled? If you put the dialog up without JavaScript, it won't be able to move or close; you'll be stuck with a giant
div
in the middle of the screen.