删除 jquery 手风琴悬停时的下划线

发布于 2024-10-27 19:10:40 字数 1913 浏览 2 评论 0原文

是否可以删除 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 技术交流群。

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

发布评论

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

评论(4

陪你搞怪i 2024-11-03 19:10:40

您需要修改 jQuery UI 附带的样式表

You need to modify the stylesheet that comes with jQuery UI.

小…楫夜泊 2024-11-03 19:10:40

尝试:

$('#accordion .ui-state-hover').css('text-decoration','none');

在几条评论后编辑:

当您不想修改所有手风琴时,只需创建新的 css 类即可。 “myAccordion”,然后使用 jquery 将 Class 添加到这两个选择器。

$('#accordion .ui-state-hover').addClass('myAccordion');
$('#accordion .ui-state-focus').addClass('myAccordion');

并修改样式表,如下所示:

.myAccordion.ui-state-hover, .myAccordion.ui-state-focus {text-decoration:none;}

如果此规则不够强大,则修改:

.myAccordion.ui-state-hover, .myAccordion.ui-state-focus {text-decoration:none !important;}

Try:

$('#accordion .ui-state-hover').css('text-decoration','none');

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.

$('#accordion .ui-state-hover').addClass('myAccordion');
$('#accordion .ui-state-focus').addClass('myAccordion');

And modify stylesheet like:

.myAccordion.ui-state-hover, .myAccordion.ui-state-focus {text-decoration:none;}

If this rule isn't strong enugh, then modify:

.myAccordion.ui-state-hover, .myAccordion.ui-state-focus {text-decoration:none !important;}
ま昔日黯然 2024-11-03 19:10:40

从外观上看,下划线似乎位于锚元素上。因此,只需将其用作 CSS:

#accordion .ui-accordion-header a {
    text-decoration: none;
}

或通过脚本作为:

$('#accordion .ui-accordion-header a').css('text-decoration','none');

我在 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:

#accordion .ui-accordion-header a {
    text-decoration: none;
}

or via script as:

$('#accordion .ui-accordion-header a').css('text-decoration','none');

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.

昔日梦未散 2024-11-03 19:10:40

你尝试过这个吗:

$('#accordion .ui-state-hover').css('text-decoration', 'none');
$('#accordion .ui-state-focus').css('text-decoration', 'none');

记得在手风琴负载之后这样做

did u try this:

$('#accordion .ui-state-hover').css('text-decoration', 'none');
$('#accordion .ui-state-focus').css('text-decoration', 'none');

remember to do that AFTER the load of the accordion

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