Jquery 手风琴问题 - 嵌套

发布于 2024-08-02 11:07:35 字数 2791 浏览 5 评论 0原文

我已经成功创建了一些单个手风琴下拉菜单,但是当我用一个手风琴嵌套一个手风琴时,Internet Explorer 变得疯狂(但 Firefox、Chrome 等对于单个手风琴和嵌套手风琴都工作得很好)。

这是单个手风琴的示例(功能齐全):

<div id="productdd">
    <h3><a href="#">Fire Pump Controllers </a></h3>
    <div>
        <ul>
            <li class="general"><a href="General Controller.html">General Selection Information</a></li>
            <li class="colors"><a href="Variable Speed.html"><b>ECV </b><p class="black">- Variable Speed Controller</p></a></li>
            <li class="colors"><a href="EC Controller.html"><b>EC</b><p class="black"> - Enhanced Controller</p></a></li>
            <li class="colors"><a href="MC Controller.html"><b>MC</b><p class="black"> - Motor Drive Controllers</p></a></li>
            <li class="colors"><a href="Diesel Controller.html"><b>DMC</b><p class="black"> - Diesel Controller</p></a></li>
        </ul>
    </div>
    <div></div>
</div>

这是我正在为嵌套版本所做的示例:

<div class="accordiondd">
    <h3 class="indenting"><a href="#">EC Drawings</a></h3>
    <div>
        <ul class="right2">
            <div class="accordiondd">
                <h3 class="secondaryh3"><a href="#"> General</a></h3>
                <div>
                    <ul class="right2a">
                        <a href="PDFs/EC/WB12098.doc" target="_blank"> 12098 - EC*: <p class="black3"> Order Selection Sheet </p></a>
                    </ul>
                </div>
                <h3 class="secondaryh3"><a href="#"> Dimensionals </a></h3>
                <div>
                    <ul class="right2a">
                        <a href="PDFs/EC/ECA,ECP,ECO std DIM 12001.pdf" target="_blank"> 12001 - ECA/ECO/ECP: <p class="black3"> 24" Wide  x  64" High  x  13" Deep - 1 Bay Enclosure</p></a>
                    </ul>
                </div>
            </div>
        </ul>
    </div>
</div>

如果有人知道为什么除 IE 之外的所有浏览器都可以使用此代码,请告诉我!这让我发疯;(谢谢,我真的很感激!

编辑:

单个手风琴的 Jquery 代码:

$(function () {
    $("#productdd").accordion({ autoHeight: false, collapsible: true, active: whichToOpen });
});

嵌套手风琴的 Jquery 代码:

$(document).ready(function () {
    $(".accordiondd").accordion({ autoHeight: false, collapsible: true, active: false });
});

I have successfully created a few single accordion drop-downs, but when I go to nest an accordion with an accordion, internet explorer goes nuts (but Firefox, Chrome, etc work just fine for both the single and nested accordion).

Here is an example of the single accordion (fully functional):

<div id="productdd">
    <h3><a href="#">Fire Pump Controllers </a></h3>
    <div>
        <ul>
            <li class="general"><a href="General Controller.html">General Selection Information</a></li>
            <li class="colors"><a href="Variable Speed.html"><b>ECV </b><p class="black">- Variable Speed Controller</p></a></li>
            <li class="colors"><a href="EC Controller.html"><b>EC</b><p class="black"> - Enhanced Controller</p></a></li>
            <li class="colors"><a href="MC Controller.html"><b>MC</b><p class="black"> - Motor Drive Controllers</p></a></li>
            <li class="colors"><a href="Diesel Controller.html"><b>DMC</b><p class="black"> - Diesel Controller</p></a></li>
        </ul>
    </div>
    <div></div>
</div>

And here is an example of what I'm working on for the nested version:

<div class="accordiondd">
    <h3 class="indenting"><a href="#">EC Drawings</a></h3>
    <div>
        <ul class="right2">
            <div class="accordiondd">
                <h3 class="secondaryh3"><a href="#"> General</a></h3>
                <div>
                    <ul class="right2a">
                        <a href="PDFs/EC/WB12098.doc" target="_blank"> 12098 - EC*: <p class="black3"> Order Selection Sheet </p></a>
                    </ul>
                </div>
                <h3 class="secondaryh3"><a href="#"> Dimensionals </a></h3>
                <div>
                    <ul class="right2a">
                        <a href="PDFs/EC/ECA,ECP,ECO std DIM 12001.pdf" target="_blank"> 12001 - ECA/ECO/ECP: <p class="black3"> 24" Wide  x  64" High  x  13" Deep - 1 Bay Enclosure</p></a>
                    </ul>
                </div>
            </div>
        </ul>
    </div>
</div>

If anyone has any idea why all browsers but IE would work with this code let me know! It's driving me nuts ;( And thanks, I really really appreciate it!

EDIT:

Jquery Code for single accordion:

$(function () {
    $("#productdd").accordion({ autoHeight: false, collapsible: true, active: whichToOpen });
});

Jquery Code for nested accordion:

$(document).ready(function () {
    $(".accordiondd").accordion({ autoHeight: false, collapsible: true, active: false });
});

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

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

发布评论

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

评论(1

家住魔仙堡 2024-08-09 11:07:35

这是一个漫长的过程,但您可以尝试将 header: 'h4' 添加到嵌套的手风琴脚本中,并将内部的 'h3' 替换为 'h4' 吗?

This is a long shot but can you try adding header: 'h4' to your nested accordion script and replacing the inner 'h3's with 'h4's?

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