Can't close menu


#1

https://www.codecademy.com/en/courses/web-beginner-en-zmn0b/0/7?content_from=make-an-interactive-website%3Ayour-first-program

I'm in need of some help.
I've checked my code four times and found no errors and i get no error messages but the body won't close when i click on the x.

Please someone help me?


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


#2

Hi @thebookpsycho,

Check your selector for .icon-close carefully :slight_smile:

Hint (click to view)

You need a dot (.) before icon-close, since you're trying to select a class, not an element


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.