From the course: Creating a Responsive Web Design: Advanced Techniques

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Removing the style attribute from the nav element

Removing the style attribute from the nav element - CSS Tutorial

From the course: Creating a Responsive Web Design: Advanced Techniques

Removing the style attribute from the nav element

- Now, the last thing we need to do to complete our collapsible menu is to remove the style attribute that's being applied to the navigation element. So, let's go back to our JavaScript file, we're going to use something called a callback function on the 'animate' function here that's running inside of the 'else' portion of the conditional statement, and we do that by coming in here after the duration, which is 750 milliseconds, still inside of the parentheses for animate, let's hit a comma, and we'll type in 'function', another set of parenthesis, another set of curly brackets, let's come in here and split this open, so, this callback function here will only run after the animation is complete. So, once the animation's complete, we want to come in here and remove the style attribute from the nav element. Now, since this item already searched for the nav element and is running the animation, we can come in here and instead use a shortcut in jQuery called 'this'. So, we'll type a…

Contents