Skip to content

Instantly share code, notes, and snippets.

@ralexandr
Created October 19, 2016 09:07
Show Gist options
  • Save ralexandr/154a0682324350589a318b670d3caf50 to your computer and use it in GitHub Desktop.
Save ralexandr/154a0682324350589a318b670d3caf50 to your computer and use it in GitHub Desktop.
SASS: Z-Index mixin
// Usage:
// .site-header {
// z-index: z('site-header');
// }
@function z($name) {
@if index($z-indexes, $name) {
@return (length($z-indexes) - index($z-indexes, $name)) + 1;
} @else {
@warn 'There is no item "#{$name}" in this list; choose one of: #{$z-indexes}';
@return null;
}
}
$z-indexes: (
"outdated-browser",
"modal",
"site-header",
"page-wrapper",
"site-footer"
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment