SyntaxError: Unexpected token '.'


#1

Not sure why this is happening. Can someone explain why the system takes the code, but my menu is not popping up or working. Please advise.

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

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


  $('.icon-close').click(function() {
    $('.menu').animate({
      left: "-285px"
    }, 200);

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

#2

@laythesmack23,
After you defines the =main= function....
it should be called
for the =Eventhandlers= to be activated.....

You do that by using

$(document).ready(main);