Created
August 6, 2014 08:05
-
-
Save christiantakle/e73bf62fc2ad1551a4a5 to your computer and use it in GitHub Desktop.
A good way keeping control of your used z-indexs to avoid confusing or bugs by choosing arbitary numbers
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
// _config.scss | |
$z-layers: ( | |
bottomless-pit: -9999, | |
default: 1, | |
dropdown: 3000, | |
overlay: 4000 | |
modal: 4001 | |
); | |
// _functions.scss | |
@function z($key) { | |
@if map-has-key($z-layers, $key) { | |
@return map-get($z-layers, $key); | |
} | |
@warn "Unknown `#{$key}` in $z-layers."; | |
@return null; | |
} | |
// _component.scss | |
.overlay { | |
z-index: z(overlay); | |
} | |
.element { | |
z-index: (z(default) + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment