5. Open the Menu


#1

So I have the following code, which passes the exercise:

var main = function() {
    $('.icon-menu').click(function() {
        $('.menu').animate({left: '+=0px'}, 200);
        $('body').animate({left: '+=285px'}, 200);
};

$(document).ready(main);

However, when I g to the window to see it in action, and click the menu icon, the page slides to the left as expected, but I just get white space where the menu should appear. I've looked at the html and it all seems to be there so not sure why this happens. Anyone?


#2

Solved it, I needed to change the animation for .menu as below:

    var main = function() {
        $('.icon-menu').click(function() {
            $('.menu').animate({left: '0px'}, 200);
            $('body').animate({left: '+=285px'}, 200);
};

$(document).ready(main);