对整个网站使用 jQuery 主题是错误的吗?

发布于 2024-08-19 06:39:20 字数 392 浏览 10 评论 0原文

我最近一直在摆弄 jquery(ui),现在我想向我的个人网站添加一些 jquery 位。好吧,Theme Roller 生成的主题真的很棒,我希望我的整个网站看起来像那样,而不仅仅是少数启用 jquery 的部分。那么,使用 http://jqueryui.com/docs/Theming/ 中列出的 css 类是错误的吗API 用于您自己的东西,但实际上不使用任何 javascript?就像做一个

有没有一些我没有看到的更简单/更干净的方法来做到这一点?这是正常做法还是矫枉过正?

I've recently been messing around with jquery(ui) and now I want to add some jquery bits to my personal website. Well, the themes produced by Theme Roller are really awesome, and I'd like my entire website to look like that, not just the few jquery enabled parts. So, is it wrong to use css classes as listed at http://jqueryui.com/docs/Theming/API for your own things that don't actually use any javascript? Like doing a <div class="ui-widget">

Is there some easier/cleaner way to do this that I'm not seeing? Is this a normal approach or is it overkill?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

瀞厅☆埖开 2024-08-26 06:39:20

答案是否定的,这并没有错。总的来说,你走在正确的轨道上。使用 JQuery 的类,它们的存在是有原因的!但是不要改变它们。如果您需要增强外观,请添加您自己的自定义类或 ID,这样您就不会弄乱默认 css 并破坏 Jquery 插件。请参阅下面的链接了解更多信息。

请记住,如果您确实计划使用 JQuery UI 作为基础,那么如果 JQuery 更改/更新其自己的 CSS 文件,您将需要担心向后兼容性问题,这是您所做的任何自定义样式都应该使用您的自定义样式的另一个原因。自己的类支持 JQuery。

http://docs.jquery.com/UI/Theming/API - 请参阅此了解在何处以及如何应用 JQuery 默认类的网页

http://www.filamentgroup.com/lab/ developer_your_own_jquery_themeroller_ready_components/ - 这有点过时,但包含有关如何将自定义类与 JQuery 配对的有用信息

http ://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/ - 本文详细介绍了按钮,请注意它比前一篇文章更新,但两者对于概念化您的想法都很有价值。

The answer is no it is not wrong. Overall you're on the right track. Use JQuery's classes they are there for a reason! However do not alter them. If you need to enhance looks, add in your own custom classes or IDs, that way you won't make a mess of the default css and break the Jquery Plug ins. Refer to the links below for more information.

Keep in mind if you do plan to use JQuery UI as a foundation, you'll need to worry about backwards compatibility issues should JQuery change/update their own CSS Files, this is another reason why any custom styling you do should be done using your own classes in support of JQuery's.

http://docs.jquery.com/UI/Theming/API - Refer to this web page to know where and how to apply JQuery's default classes

http://www.filamentgroup.com/lab/developer_your_own_jquery_themeroller_ready_components/ - This is slightly outdated but contains useful information on how to pair custom classes with JQuery

http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/ - This article gets more into buttons, note it is more up to date than the prior one but both are valuable for conceptualizing your idea.

提笔书几行 2024-08-26 06:39:20

这样做并没有错,但是如果你随意使用

jQueryUI 目前正在开发的样式,可能会让人感到困惑;最新的测试版有一个新功能,可以为您创建按钮,因此如您所见,所有样式最终都会有一个定义的目的和脚本化的方式来创建元素

It's not wrong to do so, but it may confuse people if you use the styles haphazardly

jQueryUI is currently in development; the latest beta has a new function that creates buttons for you, so as you can see, all of the styles will eventually have a defined purpose and scripted way to create elements

雨后彩虹 2024-08-26 06:39:20

不,这样做根本没有错。事实上,可以考虑利用代码来实现一个漂亮的成品。

最近在波士顿举行的 jQuery 会议上,我们看到了 Filament Group(构建主题滚轮的人)的演示,他们说他们在整个后端站点中使用了主题元素。然后,他们在与客户会面时使用小书签来动态更改整个主题。只需更改主题,整个网站就会改变风格和颜色。

请记住,当您在 HTML 中使用该类时,该点不应该出现在此处:

<div class="ui-widget">

No its not wrong to do at all. In fact, it would be considered leveraging code to achieve a nice finished product.

A the recent jQuery Conference in Boston, we got to see a demo by the Filament Group (the people who built the theme roller) and they say they use the themed elements for their entire backend sites. Then, they use a bookmarklet when they are meeting with the client to change the entire theme on the fly. Just by changing the theme, the entire website shifts style and colors.

Just remember, the dot isn't supposed to be there when you use the class in HTML:

<div class="ui-widget">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文