Skip to content

Instantly share code, notes, and snippets.

@ridgehkr
Created October 4, 2016 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridgehkr/6305d8402ce56070b8b957fc0778fcec to your computer and use it in GitHub Desktop.
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
// 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