Skip to content

Instantly share code, notes, and snippets.

@iamrobert
Last active October 14, 2018 10:02
Show Gist options
  • Select an option

  • Save iamrobert/2c1094c501361c222f6053ac4c179b58 to your computer and use it in GitHub Desktop.

Select an option

Save iamrobert/2c1094c501361c222f6053ac4c179b58 to your computer and use it in GitHub Desktop.
Zurb Foundation 6 snippets
//TRIGGER RESIZE EVENTS
// + MERGE MENUS - Secondary Nav
//TRIGGER RESIZE EVENTS
$("#resize").on(
"resizeme.zf.trigger",
Foundation.util.throttle(function() {
console.log("resize");
}, 500)
);
/*
* =======================================================================
+ MERGE MENUS - Merge Top Secondary Nav with Main Navigation
* =======================================================================
*/
app.navResize = {
init: function() {
// var $lowerNavLI = $('ul.join-menu').contents();
var $lowerNavLI = $('ul.join-menu li:not(:last)');
var $appendLI = $('#main-menu').find('li.menu-back');
var winW = window.innerWidth;
var appended = false;
if (winW < 800 && !appended) {
appended = true;
$lowerNavLI.addClass('menu-back');
$lowerNavLI.appendTo('#main-menu ul:first-child');
}
else {
if ($($appendLI).length > 1) {
$appendLI.insertBefore('ul.join-menu li');
$appendLI.removeClass('menu-back');
}
}
}
};
app.navResize.init();
$('#resize').on('resizeme.zf.trigger', function() {
app.navResize.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment