To move something, you move it from one state to another. So you are trying to change one or more properties of a .navigation element.
What properties are available for change?
You cannot change the height, width or opacity, as they must remain the same before and after the transition. If you want the transition to be associated with movement, then the best option is to transition the position of the element. Let me do this with the "top" property.
After the transition, your navigation should have 0 as its top value. Element height is 250px, so let's start with top: -250 . However, if we do this, the menu will initially be hidden. To fix this, we need to make it ignore the upper value by removing the relative positioning.
.navigation { background: #fff; width: 100%; top: -250px; }
Then we can go to 0:
#nav.affix { position: fixed; top: 0; z-index: 1030; width: 100%; -webkit-transition: all 2s ease-in; transition: all 1s ease-in; }
RESULT:
http://jsfiddle.net/ShL4T/8/
Link: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
Mark simpson
source share