5. Open the menu


#1

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

    $('body').animate({
      left: '285px'
    }, 200);
  });
};

This code not working. but he is correct

What is wrong?


#2

you forgot document ready at the end:

$(document).ready(main);

without, the menu won't work. If you don't remember this, revisit the earlier exercise


#3

I have this phase, but the code does not work


#4

can i see an updated version of your code?


#5

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

    $('body').animate({
      left: '285px'
    }, 200);
  });
};

$(document).ready(main);

#6

the menu opens fine?


#7

Oh, already open .. Apparently I made a mess with the addition of braces ..

Thank you what opened the eyes! :slight_smile: