如何防止添加CSS“类”?特性
我正在使用 Ruby on Rails 3.0.9、jQuery 1.6.2 和 jQuery UI。我正在尝试按照官方文档来实现嵌套选项卡。
当我声明以下内容(即文档源代码中所述的“正常”\“常见”方式)
<div id="tabs">
<ul>
<li>...</li>
</ul>
</div>
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
然后我去显示生成的 HTML 代码时,jQuery UI 会自动添加以下 CSS class
的属性:<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
...
</div>
是否可以阻止添加其中一些 CSS 类
?如果是这样,该怎么做?
I am using Ruby on Rails 3.0.9, jQuery 1.6.2 and jQuery UI. I am trying to implement nested tabs by following the official documentation.
When I state the following (that is the "normal"\"common" way as stated in the documentation source code)
<div id="tabs">
<ul>
<li>...</li>
</ul>
</div>
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
and then I go to display the HTML code generated, jQuery UI automatically add the following CSS class
properties to the <div id="tabs">
:
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
...
</div>
Is it possible to prevent adding some of those CSS classes
? If so, how to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您愿意,您可以随时
$("#tabs").removeClass("whatever")
,但如果这样做,您可能会失去某些功能。真正的问题是你为什么要这样做?You can always
$("#tabs").removeClass("whatever")
if you want, but you'll likely lose certain functionality if you do. The real question is why do you want to do this?如果您不想要选项卡提供的
CSS
效果,只需从CSS
文档中删除样式即可。If you don't want the
CSS
effects that the tabs are giving, just remove the styles from theCSS
document.我会覆盖您不想要效果的页面上的样式。例如,如果
ui-corner-all
在 jquery UI 样式表中具有float:left
属性,并且该样式会干扰您的页面。最好在您正在处理的页面上有一个同名的类来覆盖样式。这比修改 dom 来删除类更便宜。I would override the styles on the pages where you don't want the effect. For example if
ui-corner-all
has a property offloat:left
in the jquery UI style sheet and that style is interfering with your page. It would be best to have a class by the same name on the page you're working on to override the style. It would be less expensive than modifying the dom to remove classes.