Skip to content

Instantly share code, notes, and snippets.

@ronnieduke
Created May 6, 2014 18:10
Show Gist options
  • Save ronnieduke/48604afbf38a5e1393cc to your computer and use it in GitHub Desktop.
Save ronnieduke/48604afbf38a5e1393cc to your computer and use it in GitHub Desktop.
Treat responsive mobile nav differently
/*================================================================*/
/* 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