简体   繁体   English

Foundation 6菜单响应切换不起作用

[英]Foundation 6 Menu Responsive Toggle Not Working

I'm building a website using Foundation 6. For some reason, my mobile menu isn't functioning. 我正在使用Foundation 6建立网站。出于某种原因,我的移动菜单无法正常工作。 The menu is visible upon page load and the toggle does not function. 该菜单在页面加载时可见,并且切换功能不起作用。

My first hunch is that javascript isn't properly loaded. 我的第一个直觉是javascript没有正确加载。 app.js is loaded in the head. app.js加载在头部。 It seems that some other JS is working throughout the site. 似乎其他一些JS正在整个站点中运行。 There are no errors in the console. 控制台中没有错误。

I'm stumped. 我很沮丧

Any and all insight would be greatly appreciated. 任何和所有见解将不胜感激。

Thanks in advance! 提前致谢!

Here's are a links to one of the pages pages: 这是页面页面之一的链接:

http://robertrhu.net/desrosiers/single-residential.html http://robertrhu.net/desrosiers/single-residential.html

HERE'S THE HTML FOR THE MOBILE MENU: 这是移动菜单的HTML:

<!--Begin Mobile Title Bar Menu-->
<div id="mobile-title-bar"
     class="title-bar hide-for-medium"
     data-responsive-toggle="mobile-menu"
     data-hide-for="medium">

    <img id="mobile-logo"
         src="../assets/img/desrosiers-architects-mobile-logo.png"
         alt="Desrosiers Architects : Bloomfield, MI" />

    <h1>
        Main Heading
    </h1>

    <button class="menu-icon"
            type="button"
            data-toggle="mobile-menu">
    </button>
</div>
<!--End Mobile Title Bar Menu-->

<!--Begin Mobile Navigation Menu-->
<div id="mobile-menu"
     class="top-bar"
     data-animate="hinge-in-from-top spin-out">

    <ul id="mobile-nav"
        class="vertical menu">

        <li class="menu-item">
            <a href="residential.html">Residential</a>
        </li>

        <li class="menu-item">
            <a href="residential.html">Commercial</a>
        </li>

        <li class="menu-item">
            <a href="residential.html">New Projects</a>
        </li>

        <li class="menu-item">
            <a href="residential.html">Process</a>
        </li>

        <li class="menu-item">
            <a href="residential.html">Profile</a>
        </li>

        <li class="menu-item">
            <a href="residential.html">In The News</a>
        </li>

        <li class="menu-item">
            <a href="residential.html">About</a>
        </li>
    </ul>
</div>
<!--End Mobile Navigation Menu-->

HERE'S THE SCSS FOR THE MOBILE MENU: 这是用于移动菜单的SCSS:

#mobile-menu {
    background-color: transparent;
    display: none;

    ul#mobile-nav {
        background-color: transparent;
        text-transform: uppercase;
        font-weight: 700;
        width: 150px;
        padding: 2px 0 3px 20px;

        li.menu-item {
            padding: 7px 0;

            a {
                padding: 0;
                transition: all 0.5s ease;
            }
        }

        li.menu-item:nth-of-type(3){
            padding-bottom: 18px;
        }

        li.menu-item:nth-of-type(4){
            padding-top: 18px;
            border-top: 1px dashed $anchor-color;
        }
    }
}

HERE'S A SCREENSHOT SHOWING THAT APP.JS IS IN FACT IN THE HEAD: enter image description here 这是一个屏幕快照,显示APP.JS实际上在头部: 在此处输入图像描述

I figured out my problem. 我发现了我的问题。 The app.js foundation initialization wasn't correct. app.js基础初始化不正确。

In the original package I downloaded had: 在我下载的原始软件包中有:

$(document).foundation();

I had to change it to: 我不得不将其更改为:

$(document).ready(function(){

    $(document).foundation();

});

All my javascript is loading correctly now. 我所有的JavaScript现在都正确加载。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM