I currently have a hamburger and menu positioned on the left side, with a width set to 0px
.
Is there a way for me to make the width of the menu change to 250px
after clicking on the hamburger icon for the first time, and then change back to 0px
after clicking on it for the second time?
var initialWidth = $('.hamburger-menu__list').css('width');
$('.hamburger-toggle').click(function(){
$(this).toggleClass('open');
if (initialWidth == '0' ) {
$('.hamburger-menu__list').css('width', 250);
}
else {
$('.hamburger-menu__list').css('width', 0);
};
});