Created
May 6, 2014 18:10
-
-
Save ronnieduke/48604afbf38a5e1393cc to your computer and use it in GitHub Desktop.
Treat responsive mobile nav differently
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*================================================================*/ | |
/* DESKTOP MENU | |
/*================================================================*/ | |
if (document.documentElement.clientWidth > 767) { //if client width is greater than 767px | |
ddsmoothmenu.init({ | |
mainmenuid: "main_menu", | |
orientation: 'h', | |
contentsource: "markup", | |
showhidedelay: {showdelay: 300, hidedelay: 100} //set delay in milliseconds before sub menus appear and disappear, respectively | |
}) | |
} // end if | |
/*================================================================*/ | |
/* SWITCH TO MULIT-LEVEL ACCORDION when mobile | |
/*================================================================*/ | |
if (document.documentElement.clientWidth < 767) { //if client width is less than 767px | |
$(document).ready(function() { | |
// accordion | |
$('.accordmobile').dcAccordion({ | |
eventType: 'click', | |
saveState: false, | |
autoClose: true, | |
disableLink: false, | |
speed: 'fast', | |
showCount: false, | |
autoExpand: false, | |
classExpand : 'parent' | |
}); | |
}); // end document ready | |
} // end if | |
/*================================================================*/ | |
/* MOBILE NAV TRIGGER | |
/*================================================================*/ | |
$(document).ready(function(){ | |
$('.mobile_nav a').click(function(){ | |
$('#main_menu').slideToggle(400); | |
$(this).toggleClass('active'); return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment