Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$(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