Allowing me to proceed, but the menu isn't working


#1

Hey, i'm currently on 6/8, in the last section i created the function to open the menu from the left on 5/8 and proceeded foward and i found that the menu isn't showing from the left, when i click on the menu button , and i get the error
'Uncaught SyntaxError: Unexpected token }'

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

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


If someone could point me in the right direction of where i've went wrong , i'd really appreciate it.
I don't really want to proceed while this is happening, just incase if causes me some issues later on in the course.

Thanks :slightly_smiling:


#2

Hi click should be a function so its should be like that
$('.icon-menu').click(function(){}; and you add one}; that no necessary the one before the }); so your code should be like that

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

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

#3

Thanks so much! :slightly_smiling: that worked perfectly