sdfdsfsdf

Some Notes About The CSS

To begin, the CSS is standard. We have a fixed header that is stuck to the top of the page using top and left. It’s width is set to 100%, and I’ve given it a height of 150px. Our z-index keeps it above everything else, and we also give it a CSS3 transition property so that when it resizes, it does so smoothly. We’ll add a smallerclass definition in our CSS also, and under this, our header will have its resized properties. When the header has the class of smaller, it will resize. This class will be added on scroll (as we’ll see in the javascript later).

The logo and navigation items are given a line height of the header’s height (i.e. 150px) to start. When the header gets resized on scroll, we’ll shrink these values to 75px. We will also change the font size of the logo to something smaller to fit the available space.

Finally, I added some example media queries so that our animated resizing header will work across all devices and screen sizes. Now, let’s make the magic happen. We’re going to use javascript to add and remove the class smaller when we scroll a certain amount. Adding and removing this class will animate our header.

Some Notes About The CSS

To begin, the CSS is standard. We have a fixed header that is stuck to the top of the page using top and left. It’s width is set to 100%, and I’ve given it a height of 150px. Our z-index keeps it above everything else, and we also give it a CSS3 transition property so that when it resizes, it does so smoothly. We’ll add a smallerclass definition in our CSS also, and under this, our header will have its resized properties. When the header has the class of smaller, it will resize. This class will be added on scroll (as we’ll see in the javascript later).

The logo and navigation items are given a line height of the header’s height (i.e. 150px) to start. When the header gets resized on scroll, we’ll shrink these values to 75px. We will also change the font size of the logo to something smaller to fit the available space.

Finally, I added some example media queries so that our animated resizing header will work across all devices and screen sizes. Now, let’s make the magic happen. We’re going to use javascript to add and remove the class smaller when we scroll a certain amount. Adding and removing this class will animate our header.