删除 jquery 手风琴悬停时的下划线
是否可以删除 jquery ui 手风琴的下划线(文本装饰:无)?
我尝试了许多不同的解决方案,但似乎都不起作用。也许我没有选择正确的样式 ID。
例如...
$('#accordion .ui-state-hover').attr('style', 'text-decoration:none');
$('#accordion .ui-state-focus').attr('style', 'text-decoration:none');
$('#accordion .ui-state-hover').css('text-decoration', 'none');
编辑:我知道我可以更改 CSS 样式表,但我只想对众多手风琴之一执行此操作。
EDIT2:这是实际的代码......
<style type="text/css">
.myAccordion.ui-state-hover, .myAccordion.ui-state-focus {text-decoration:none !important;}
</style>
<!--Downtime Announcement begin-->
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#accordion").accordion({
collapsible: true,
active: false
});
$('#accordion .ui-icon').attr('style', 'display: none');
$('#accordion .ui-accordion-header').attr('style', 'background:#A4000F');
$('#accordion .ui-accordion-header a').attr('style', 'font-weight:bold;font-size:13px;color:white');
$('#accordion .ui-accordion-content').attr('style', 'background:#A4000F;width:auto');
$('#accordion .ui-accordion-content p').attr('style', 'font: 14px/16px Arial,Helvetica,sans-serif;color:white');
$('#accordion .ui-state-hover').addClass('myAccordion');
$('#accordion .ui-state-focus').addClass('myAccordion');
});
</script>
<div id="accordion" >
<h3><a href="#">Important Announcement</a></h3>
<div>
<p>Beginning at 6pm EDT on April 1st, 2011 our websites will be down for a system upgrade. Please return later in the weekend when the site will return to full availability.</p>
</div>
</div>
<!--Downtime Announcement end-->
Is it possible to remove the underline (text-decoration:none) for the jquery ui accordion?
I tried many different solutions, but none seem to work. Maybe I am not selecting the proper style id.
For example...
$('#accordion .ui-state-hover').attr('style', 'text-decoration:none');
$('#accordion .ui-state-focus').attr('style', 'text-decoration:none');
$('#accordion .ui-state-hover').css('text-decoration', 'none');
EDIT: I understand that I can just change the CSS stylesheet, but I only want to do this for ONE of the many accordions.
EDIT2: Here is the actual code...
<style type="text/css">
.myAccordion.ui-state-hover, .myAccordion.ui-state-focus {text-decoration:none !important;}
</style>
<!--Downtime Announcement begin-->
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#accordion").accordion({
collapsible: true,
active: false
});
$('#accordion .ui-icon').attr('style', 'display: none');
$('#accordion .ui-accordion-header').attr('style', 'background:#A4000F');
$('#accordion .ui-accordion-header a').attr('style', 'font-weight:bold;font-size:13px;color:white');
$('#accordion .ui-accordion-content').attr('style', 'background:#A4000F;width:auto');
$('#accordion .ui-accordion-content p').attr('style', 'font: 14px/16px Arial,Helvetica,sans-serif;color:white');
$('#accordion .ui-state-hover').addClass('myAccordion');
$('#accordion .ui-state-focus').addClass('myAccordion');
});
</script>
<div id="accordion" >
<h3><a href="#">Important Announcement</a></h3>
<div>
<p>Beginning at 6pm EDT on April 1st, 2011 our websites will be down for a system upgrade. Please return later in the weekend when the site will return to full availability.</p>
</div>
</div>
<!--Downtime Announcement end-->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要修改 jQuery UI 附带的样式表。
You need to modify the stylesheet that comes with jQuery UI.
尝试:
在几条评论后编辑:
当您不想修改所有手风琴时,只需创建新的 css 类即可。 “myAccordion”,然后使用 jquery 将 Class 添加到这两个选择器。
并修改样式表,如下所示:
如果此规则不够强大,则修改:
Try:
Edit after few comments:
When you don't want to modify all accordions, then just create new css class ie. "myAccordion", then use jquery to addClass to those two selectors.
And modify stylesheet like:
If this rule isn't strong enugh, then modify:
从外观上看,下划线似乎位于锚元素上。因此,只需将其用作 CSS:
或通过脚本作为:
我在 jsFiddle 上进行了快速演示: http://jsfiddle .net/93hw2。我确信这将来会派上用场。
From the looks of it, it seems the underline is on the anchor element. So, just use this as CSS:
or via script as:
I set this up on jsFiddle for a quick demo: http://jsfiddle.net/93hw2. I'm sure this will come in handy in the future.
你尝试过这个吗:
记得在手风琴负载之后这样做
did u try this:
remember to do that AFTER the load of the accordion