Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Konrad Pilch
Konrad Pilch
2,435 Points

How to add animation?

Hello,

I know how to add animatino with jQuery, its just that i have no idea how to add animation like transition.

I know i can hide it and then fadeOut, but what about transition?

Heres my code

Im basically trying to reduplicate this site header(if you scroll down and up and look at the nav): http://www.bradhussey.ca/

2 Answers

Shane Oliver
Shane Oliver
19,965 Points

The link to your code doesn't work, but you will need to add a z-index to the nav to place it on top of all other elements. Try logging to the console to determine the problem.

Konrad Pilch
Konrad Pilch
2,435 Points

It shoudl work now. I don't know how the console logs work with codepen : p

Shane Oliver
Shane Oliver
19,965 Points

you are adding the class incorrectly and in the wrong place.

add this line to your conditional checking the scroll position var navbar = $('nav').addClass('fixed');