JavaScript: Making a scroll-dependent menu bar with CSS3 and JavaScript

Making your menu bar fix to the top of the page is something that’s been done a lot. However what if you don’t want to start your menu out as being fixed to the top? And how do you make your menu look different from its original state when you make it fix to the top of the screen?