jQuery SlideToggle 不适用于 IE8

发布于 2024-10-07 10:38:04 字数 1055 浏览 0 评论 0原文

可能的重复:
仅使用列表的 IE8 中的 Jquery slipToggle 问题

我有一个代码该幻灯片切换列表项的内容。它在 FF 中工作正常,但在 IE8 中,当单击该项目时,它不是幻灯片显示内容,而是始终显示内容并向上滑动以隐藏它。 这是列表的代码:

<ul class="accordion">
    <li>
        <h4 class="head">Title 1</h4>
        <p>Content 1.</p>
    </li>
    <li>
        <h4 class="head">Title 2</h4>
        <p>Content 2.</p>
    </li>
</ul>

这是 JS/jQuery 代码:

$(document).ready(function(){
    $('.accordion .head').click(function() {
        $(this).next().slideToggle(250);
        return false;
    }).next().hide();
});

这是在线页面: http ://grupoautolider.com.ar/galeria/cabriolet

这很奇怪,因为这段代码出现在 jQuery UI 的文档页面中。必须注意的是,这在 IE7 中不会发生。我将非常感谢您的回答。提前致谢。

Possible Duplicate:
Jquery slideToggle problem in IE8 only using lists

I have a code that slideToggles the contents of list items. It works fine in FF but in IE8 when clicking the item, instead of slide show the content, it always shows the content and slides up to hide it.
Here is the code of the list:

<ul class="accordion">
    <li>
        <h4 class="head">Title 1</h4>
        <p>Content 1.</p>
    </li>
    <li>
        <h4 class="head">Title 2</h4>
        <p>Content 2.</p>
    </li>
</ul>

This is the JS/jQuery code:

$(document).ready(function(){
    $('.accordion .head').click(function() {
        $(this).next().slideToggle(250);
        return false;
    }).next().hide();
});

And here is the online page: http://grupoautolider.com.ar/galeria/cabriolet

This is strange because this code is featured in jQuery UI's doc page. It must be noted that this doesn't happen in IE7. I would be very grateful for your answers. Thanks in advance.

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

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

发布评论

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

评论(1

偏爱自由 2024-10-14 10:38:04

我想您正在谈论这里提到的问题: slideToggle导致 IE8 中的边距消失

只需将溢出:隐藏给边距消失的 div 即可解决。请检查..

I guess you are talking about the problem as mentioned here : slideToggle causes margin to disappear in IE8

just giving overflow:hidden to the divs where margin is disappearing would solve it. please check..

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