Last active
December 19, 2015 17:39
-
-
Save elisechant/5993165 to your computer and use it in GitHub Desktop.
extend Zurb Foundation 4 TopBar to allow slide animation for mobile viewport #foundationzurb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nav { | |
| @include sliding-nav($nav-item-index:8); // note - set only one SASS parameter by using named variables syntax | |
| .top-bar { | |
| // .. | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // =============================================== | |
| // extends foundation/components/top-bar | |
| // =============================================== | |
| // Sliding mobile navigation ===================== | |
| // | |
| // CSS Transitions for height=n -> height=auto have a bug where | |
| // the height transitions from 100px to 0px, then jumps to ~550px | |
| // Overcome this by transitioning 'max-height' rather than 'height' | |
| // | |
| // @source http://stackoverflow.com/questions/15922076/css3-transition-to-height-auto-goes-to-height-0-first | |
| // @use apply to wrapper class | |
| // | |
| // 1. a number higher than the expanded menu height, the browser | |
| // uses this value to calculate transition duration, keep it as | |
| // small as possible | |
| @mixin sliding-nav($speed:800ms, $nav-item-index:4, $ease:ease) { | |
| .top-bar { | |
| max-height: $topbar-height; | |
| @include transition(max-height $speed $ease); | |
| &.expanded { | |
| max-height: $topbar-height * $nav-item-index; // 1. | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment