【发布时间】:2015-04-22 14:57:40
【问题描述】:
我正在尝试切换导航,但我似乎无法弄清楚我的代码有什么问题。这很混乱,因为我使用的是 CMS,它创建了列表菜单中使用的 id 和 class。理想情况下,我会为列表起一个更好的名称。
我已将代码发布到https://jsfiddle.net/chachacallis/amfmsors/1/
$(document).ready(function () {
$('ul ul').hide();
$('ul li span.section_title a').removeAttr("href");
$('ul li span.section_title > a').click(function (event) {
$('ul ul').hide('slow');
$(this).parent().find('ul').toggle('slow');
});
});
更新 如果我不想为主页和其他没有子菜单的项目禁用默认操作怎么办?如何将它添加到现有代码中?
【问题讨论】:
标签: jquery drop-down-menu menu navigation