如何使用nextUntil()和not()修复jQuery子菜单手风琴

How to fix jQuery submenu accordion using nextUntil() and not()?

本文关键字:jQuery 手风琴 修复 菜单 何使用 nextUntil not      更新时间:2023-09-26

我正在尝试使用 jQuery 的 nextUntil(),但是当我单击子div 时,其他父div 正在关闭。我想在下一个Follows函数之前使用.not()。

我正在尝试实现隐藏和显示儿童div的正确方法。

谢谢
$('.content').click(function() {
    $(this).not('.head').nextUntil('.content').toggle('slow');
    $('.subcontentchild').hide();
    return false;
});

http://jsfiddle.net/pys5T/8/

您可以指定多个选择器,以,分隔:

$('.content').click(function() {
    $(this).nextUntil('.content,.head').toggle('slow');
    $('.subcontentchild').hide();
    return false;
});

查看更新的小提琴