Created
October 4, 2016 19:57
-
-
Save ridgehkr/6305d8402ce56070b8b957fc0778fcec to your computer and use it in GitHub Desktop.
A way of managing z-index values to keep them from getting out of control
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
// Define a map of z-index layers. Utilized by layer() | |
$layers: ( | |
foreground: 1, | |
local-hero: 2, | |
local-superhero: 3, | |
global-hero: 4, | |
global-superhero: 5, | |
); | |
/* | |
OPTIONAL: I prefer to wrap the map-get call in a function to make my SCSS more self-documenting and to allow for enhancements in the future. | |
Usage: | |
z-index: layer(); // default base layer | |
z-index: layer( local-hero ); | |
*/ | |
@function layer( $class: foreground ){ | |
@return map-get( $layers, $class ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment