2

我正在使用此处找到的完美脚本:http: //vandelaydesign.com/blog/web-development/vertical-accordion/#comment-338149。唯一的问题是添加多个级别不起作用。我已经完成了 mad 之类的教程,并且根据作者的页面,它应该可以工作。

我在这里添加了代码:http: //jsfiddle.net/5mSwk/

$(document).ready(function() {
    $("#nav > li > a").on("click", function(e) {
        if ($(this).parent().has("ul")) {
            e.preventDefault();
        }

        if (!$(this).hasClass("open")) {
            // hide any open menus and remove all other classes
            $("#nav li ul").slideUp(350);
            $("#nav li a").removeClass("open");

            // open our new menu and add the open class
            $(this).next("ul").slideDown(350);
            $(this).addClass("open");
        }

        else if ($(this).hasClass("open")) {
            $(this).removeClass("open");
            $(this).next("ul").slideUp(350);
        }
    });
});

我尝试过的其他手风琴脚本在同一页面 (bxSlider) 上破坏图像库,即使包装没有冲突。我已经尝试了超过 14 种不同的菜单和 30 多个教程,试图让其中一个在没有冲突的情况下正常工作。

唯一的好处是我几乎秃顶了,所以至少大部分灰色都消失了。任何朝着正确方向的推动将不胜感激。

4

0 回答 0