简体   繁体   中英

Slide toggle nav only works on home page

Site in question: http://mtthwbsh.com

For my mobile nav I am using the following script to toggle it open/closed:

$(document).ready(function(){
/* toggle nav */
$("#menu-icon").on("click", function(){
    $(".nav").slideToggle();
    $(this).toggleClass("active");
    $("#menu-icon img").toggleClass("rotate");
});
});

This works fine on the homepage, but on interior pages it does not toggle, and when searching and viewing the results the entire nav disappears. I am using a conditional tag to load a separate nav on interior pages and am not sure if this is the issue.

your smoothscroll.js throws an error, which probably stops the rest of your javascript from being executed:

Uncaught TypeError: Cannot read property 'top' of undefined

that happens when it is searching for an id "#work" which seems to be missing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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