Last active
August 29, 2015 14:14
-
-
Save jakob-e/fb45b3372c7a307ed5fb to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
| SCSS Managing z-index |
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
| // ---- | |
| // Sass (v3.4.9) | |
| // Compass (v1.0.1) | |
| // ---- | |
| // z-index function | |
| @function z-index($keys...){ | |
| $index: map-deep-get($z-index, $keys...); | |
| @if type-of($index) == map { $index: map-deep-get($index, default); } | |
| $index: 1 !default; @return $index; | |
| } | |
| // shorthand | |
| @function z($arglist...){ @return z-index($arglist...); } | |
| // dependency (externalize) | |
| @function map-deep-get($map, $keys...) { | |
| @each $key in $keys { $map: map-get($map, $key); } | |
| @return $map; | |
| } | |
| // Config | |
| $z-index:( | |
| // default : 0, // Defined level default z-index: z(); | |
| navigation: 6, | |
| modal:( | |
| default: 7, // Defined level default z-index: z(modal); | |
| overlay: 10, | |
| content: 11 | |
| ) | |
| ); | |
| // Example | |
| nav { z-index: z(navigation); } | |
| .modal { | |
| z-index: z(modal); | |
| &-overlay { z-index: z(modal, overlay); } | |
| &-content { z-index: z(modal, content); } | |
| } | |
| // CSS | |
| nav { z-index: 6; } | |
| .modal-overlay { z-index: 10; } | |
| .modal-content { z-index: 11; } |
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 { z-index: 6; } | |
| .modal { z-index: 7; } | |
| .modal-overlay { z-index: 10; } | |
| .modal-content { z-index: 11; } | |
| nav { z-index: 6; } | |
| .modal-overlay { z-index: 10; } | |
| .modal-content { z-index: 11; } |
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
| SCSS Managing z-index |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment