基本上试图创建一个多层向下滑动单击菜单,我已经将子菜单设置为向下滑动,但是当我单击子项时,我无法弄清楚如何阻止父级滑动。谢谢你的帮助!
html代码------------------------------------------------ ----------------------
<!--Nav Menu 1-->
<ul class="make">Club Car
<ul class="model" style="display: none">Precedent
<ul class="product" style="display: none">Brush Guard</ul>
<ul class="product" style="display: none">Lift Kits</ul>
</ul>
<ul class="model" style="display: none">DS
<ul class="product" style="display: none">Brush Guard</ul>
<ul class="product" style="display: none">Lift Kits</ul>
</ul>
</ul>
<!--- Nav Menu 2-->
<ul class="make">E-Z-Go
<ul class="model" style="display: none">TXT
<ul class="product" style="display:none">Brush Guard</ul>
<ul class="product" style="display:none">Lift Kits</ul>
</ul>
<ul class="model" style="display: none">RXV
<ul class="product" style="display:none">Brush Guard</ul>
<ul class="product" style="display:none">Lift Kits</ul>
</ul>
Jquery 脚本------------------------------------------------ --
<script>
$("ul.make").click(function () {
if ($(this).children('ul').is(":hidden")) {
$(this).children('ul').slideDown("fast");
}
else {
$(this).children('ul').slideUp("fast");
}
});
$("ul.model").click(function () {
if ($(this).children('ul').is(":hidden")) {
$(this).children('ul').slideDown("fast");
}
else {
$(this).children('ul').slideUp("fast");
}
});
</script>