Skip to content

Instantly share code, notes, and snippets.

@PlenipotentSS
Last active August 29, 2015 14:17
Show Gist options
  • Save PlenipotentSS/bd4547c354d797b76f2f to your computer and use it in GitHub Desktop.
Save PlenipotentSS/bd4547c354d797b76f2f to your computer and use it in GitHub Desktop.
Hammie JS
var $win, $doc,
$body = $('body'),
$main = $('main'),
$hammie = $('.hammie');
var toggleMobileMenu = function() {
if ($body.hasClass('is-active')) {
$mobileDrawer.animate({
height: 0
}, function() {
$body.toggleClass('is-active');
});
} else {
$body.toggleClass('is-active');
}
};
var toggleMobileMenu = function() {
$body.toggleClass('is-active');
};
var removeMobileMenu = function() {
$body.removeClass('is-active');
$hammie.removeClass('is-close-menu-btn');
};
var addEventHandlers = function() {
$hammie.on('click', function(e) {
e.preventDefault();
$hammie.toggleClass('is-close-menu-btn');
toggleMobileMenu();
});
$win.resize(function(){
if ( $win.outerWidth() > 640 ) {
removeMobileMenu();
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment