Skip to content

Instantly share code, notes, and snippets.

@adammenges
Created August 11, 2014 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adammenges/c1cb3024040025a5b706 to your computer and use it in GitHub Desktop.
Save adammenges/c1cb3024040025a5b706 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
var closeMenu = function() {
$('#container').unbind('touchmove');
$("#container").animate({"margin-left": "0"}, {
duration: 700,
complete: function() {
$('#content').css('width', 'auto');
$('#contentLayer').css('display', 'none');
}
});
};
var openMenu = function() {
var contentWidth = $('#content').width();
$('#content').css('width', contentWidth);
$('#contentLayer').css('display', 'block');
$('#container').bind('touchmove', function(e){e.preventDefault()});
$("#container").animate({"margin-left": "80%"}, {
duration: 700
});
};
// Open/Close the menu
$(".hamburger-menu-icon").click(function() {
if ($('#container').css('margin-left') == "0px") {
openMenu();
}
else {
closeMenu();
};
});
// Close the menu
$("#contentLayer").click(closeMenu);
//open/close search box mobile
$(".search-button-text-mobile").click(function() {
if ($('.searchBoxMobile').css('display') == 'block') {
$('.searchBoxMobile').css('display', 'none');
$('.wrapper').css('padding-top', '50px');
}
else {
$('.searchBoxMobile').css('display', 'block');
$('.wrapper').css('padding-top', '100px');
};
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment