如何防止 jquery UI 自动添加样式?
我想知道告诉 jquery UI 不要添加样式类的最简单方法是什么?我正在尝试使用选项卡插件,它有很多我想要的功能......但我实际上希望它在样式方面什么都不做。我想完全掌控它,因为坦率地说,默认设置太复杂了,不适合极简设计。
我在这里发现了类似的问题......: jquery ui tabs 主要样式更改
...但他们从未抽出时间来阻止首先添加类。
您可以拒绝加载文档顶部的 css 主题,但是选项卡小部件将停止工作,尽管不会导致任何 javascript 错误。整个情况实在是太糟糕了,我不想仅仅因为 jquery UI 拒绝让我使用自己的样式就必须编写自己的选项卡小部件:(
帮助?
I'm wondering what is the easiest way of telling jquery UI not to add style classes? I am trying to use the tabs plugin, which has a lot of functionality I want... but I actually want it to do NOTHING when it comes to styles. I want to be in total charge of it, because frankly, the defaults are too busy and just don't work for a minimlist design.
I found a similar question here...:
jquery ui tabs major style change
... But they never got around to preventing the classes from being added in the first place.
You can just refuse to load the css theme at the top of the document, but then the tabs widget just ceases to work despite not causing any javascript errors. The entire situation is just awful to be in, and I'd hate to have to program my own tabs widget just because jquery UI refuses to let me use my own styles :(
Help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您想要现有样式,除了某些小部件(选项卡)之外,您可以添加外部 div#mytabs,然后覆盖 jquery UI 应用的任何默认样式。
快速(粗略)演示来说明我的观点。
这将使您可以选择在不同区域使用默认样式(甚至是选项卡)。当然,您可以只更改 .ui-tabs-nav 类的样式(或者再次覆盖)。
If you want existing styling, with the exception of some widgets (tabs), you could add an outer div#mytabs and then override any default styling applied by jquery UI.
Quick (rough) demo to illustrate my point.
This would give you the option of using the default styling (even of tabs) in a different area. You could, of course, just change the styling (or again, do overrides) on the .ui-tabs-nav classes.
如果您正在寻找一个阻止添加类的 jQuery UI 选项,那么您就不走运了。
你最好的选择是像 @brett 建议的那样,制作一个极简主义主题。或者,我可以想象一个 JavaScript 函数,它给定一个 DOM 元素,对其进行搜索,然后子级在其 class 属性中查找类列表,然后删除每个元素。虽然看起来很邪恶!
If you're looking for a jQuery UI option that prevents the adding of classes, you are out of luck.
Your best bet is as @brett suggested, make a minimalist theme. Alternatively, I can imagine a javascript function that given an DOM element, searched through it and children looking for a list of classes in their class attribute, then removing each one. Seems evil though!
另一种选择是有选择地删除 jQueryUI 自动添加的类,
例如:
another option would be to remove selectively the class automatically added by jQueryUI
somehting like:
也许在下载 jquery ui pack 时添加 css 范围
maybe add css scope while downloading jquery ui pack