Push Menu not animating


#1



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


In the previous lesson, my code was accepted (though I tried to click icon-menu and it did not move). I continued to the next lesson to see the corrected code, but it is the same and the menu is still not moving. My instructions tell me to click the menu button to see it move, and then notice how it won't close, but it won't open either.

My code is below.


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

$(document).ready(main);


#2

Hi @athys,

$('.body')

You're selecting the <body> tag incorrectly. The dot (.) in front of it indicates an element with the class="body" attribute, but you want the <body> tag. Change that line to just $('body'), and your code should work :slight_smile:


#3

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