Skip to content

Instantly share code, notes, and snippets.

@tzafrir
Created June 14, 2015 08:12
Show Gist options
  • Save tzafrir/5a0687d331c5ef5b4508 to your computer and use it in GitHub Desktop.
Save tzafrir/5a0687d331c5ef5b4508 to your computer and use it in GitHub Desktop.
z function without specifying values
$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