Drop down menu 基础5:下拉菜单链接不激活 我发现自从基金会3以来提到的类似的错误,通常是因为不包括基础。我有这个,但在下拉菜单中的链接不工作 <!doctype html> <html class="no-js" lang="en"> <head> <link rel="stylesheet" href="../css/normalize.css" /> <link rel="stylesheet" href="../css/foundation.min.css" /> <link rel="stylesheet" href="includes/style.css" /> <script src="../js/vendor/jquery.js"></script> <script src="../js/foundation.min.js"></script> <script src="../js/vendor/modernizr.js"></script> <script> $(document).foundation(); </script> </head> <body> <nav class="top-bar" data-topbar role="navigation"> <ul class="title-area"> <li class="name"> <h1><a href="#">dashboard</a></h1> </li> <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone --> <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li> </ul> <section class="top-bar-section"> <!-- Left Nav Section --> <ul class="left"> </ul> <!-- Right Nav Section --> <ul class="right"> <li><a href="chapters.php">chapters</a></li> <li><a href="sections.php">sections</a></li> <li><a href="paragraphs.php">paragraphs</a></li> <li><a href="references.php">references</a></li> <li><a href="annotations.php">annotations</a></li> <li><a href="help.php">help</a></li> <li class="has-dropdown"> <a href="#" class="name">Create</a> <ul class="dropdown"> <li><a href="categories.php?task=new">new chapter</a></li> <li><a href="sections.php?task=new">new section</a></li> <li><a href="paragraphs.php?task=new">new paragraph</a></li> <li><a href="annotations.php?task=new">new annotation</a></li> </ul> </li> </ul> </section> </nav> </body> </html> $(document.foundation();

Drop down menu 基础5:下拉菜单链接不激活 我发现自从基金会3以来提到的类似的错误,通常是因为不包括基础。我有这个,但在下拉菜单中的链接不工作 <!doctype html> <html class="no-js" lang="en"> <head> <link rel="stylesheet" href="../css/normalize.css" /> <link rel="stylesheet" href="../css/foundation.min.css" /> <link rel="stylesheet" href="includes/style.css" /> <script src="../js/vendor/jquery.js"></script> <script src="../js/foundation.min.js"></script> <script src="../js/vendor/modernizr.js"></script> <script> $(document).foundation(); </script> </head> <body> <nav class="top-bar" data-topbar role="navigation"> <ul class="title-area"> <li class="name"> <h1><a href="#">dashboard</a></h1> </li> <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone --> <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li> </ul> <section class="top-bar-section"> <!-- Left Nav Section --> <ul class="left"> </ul> <!-- Right Nav Section --> <ul class="right"> <li><a href="chapters.php">chapters</a></li> <li><a href="sections.php">sections</a></li> <li><a href="paragraphs.php">paragraphs</a></li> <li><a href="references.php">references</a></li> <li><a href="annotations.php">annotations</a></li> <li><a href="help.php">help</a></li> <li class="has-dropdown"> <a href="#" class="name">Create</a> <ul class="dropdown"> <li><a href="categories.php?task=new">new chapter</a></li> <li><a href="sections.php?task=new">new section</a></li> <li><a href="paragraphs.php?task=new">new paragraph</a></li> <li><a href="annotations.php?task=new">new annotation</a></li> </ul> </li> </ul> </section> </nav> </body> </html> $(document.foundation();,drop-down-menu,zurb-foundation,Drop Down Menu,Zurb Foundation,我是不是错过了一个场景?我已经看到preventDefault()被认为是一个可能的罪魁祸首,但为什么默认的点击行为会被阻止…对于可点击的菜单链接?the$(document).foundation()行必须在结束BODY标记之前调用,而不是HEAD标记。在加载DOM元素之前,我正在加载基础。 这就解释了这种古怪的行为。在我看来,它的工作方式很奇怪。我不明白为什么它不能在我的服务器上工作。在小视图中,汉堡包菜单也不起作用。

我是不是错过了一个场景?我已经看到preventDefault()被认为是一个可能的罪魁祸首,但为什么默认的点击行为会被阻止…对于可点击的菜单链接?

the
$(document).foundation()行必须在结束BODY标记之前调用,而不是HEAD标记。在加载DOM元素之前,我正在加载基础。


这就解释了这种古怪的行为。

在我看来,它的工作方式很奇怪。我不明白为什么它不能在我的服务器上工作。在小视图中,汉堡包菜单也不起作用。