Created
June 14, 2015 08:12
-
-
Save tzafrir/5a0687d331c5ef5b4508 to your computer and use it in GitHub Desktop.
z function without specifying values
This file contains 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
$z-elements: 'main' | |
'header' | |
'overlay-above-header'; | |
$z-layers: (); | |
$z-multiplier: 10; | |
@each $z-element in $z-elements { | |
$z-index: $z-multiplier * index($z-elements, $z-element); | |
$z-layers: map-merge($z-layers, ($z-element: $z-index)); | |
} | |
@function z($layer) { | |
@if not map-has-key($z-layers, $layer) { | |
@error "No layer found for `#{$layer}` in $z-layers map. Property omitted."; | |
} | |
@return map-get($z-layers, $layer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment