8/8 "Congratulations!" Let me pass, yet the menu does not work


#1

Well I am on 8/8, and despite having "correct" code, the push menu does not work...
Code is as follows, with this error "Uncaught SyntaxError: Unexpected token )"

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);

    });
    
};

Anyone know why?


#2

Hi Classographic,

Try comparing your the way you close your first two .animate()s to the last two .animate()s (hint: the second two are correct)


#3

Hi zystvan,

I get the same thing (menu doesn't move either). And I'm closing both the same way, as follows:

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);
});

};
$(document).ready(main);

Any idea why the menu won't move?


FORGOT THE dots BEFORE 'body'. '.body' is the way to select it. Got it to work now!


#4

@nooness NO! There shouldn't be any dots before body. The problem you have is that your first (correct) $('.menu') is actually (incorrect) $(.'menu').


#5

Always be careful on the symbols as ; : = ''...

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);
});

};

$(document).ready(main);


#6

4 posts were split to a new topic: Menu works, but doesn't let me pass - what's wrong?


#10