Skip to content

Instantly share code, notes, and snippets.

@KittyGiraudel
Created June 20, 2014 16:20
Show Gist options
  • Save KittyGiraudel/341c052928c956c1a751 to your computer and use it in GitHub Desktop.
Save KittyGiraudel/341c052928c956c1a751 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
$z-layers: (
"goku": 9001,
"shoryuken": 8000,
"modal": (
"base": 500,
"close": 100,
"header": 50,
"footer": 10
),
"default": 1,
"below": -1,
"bottomless-pit": -9000
);
@function map-has-nested-keys($map, $keys...) {
@each $key in $keys {
@if not map-has-key($map, $key) {
@return false;
}
$map: map-get($map, $key);
}
@return true;
}
@function map-deep-get($map, $keys...) {
@each $key in $keys {
$map: map-get($map, $key);
}
@return $map;
}
@function z($layers...) {
@if not map-has-nested-keys($z-layers, $layers...) {
@warn "No layer found for `#{inspect($layers...)}` in $z-layers map. Property omitted.";
}
@return map-deep-get($z-layers, $layers...);
}
.modal {
position: absolute;
z-index: z("modal", "base");
.close-button {
z-index: z("modal", "close");
}
header {
z-index: z("modal", "header");
}
footer {
z-index: z("modal", "footer");
}
}
.goku {
z-index: z("goku");
}
.modal {
position: absolute;
z-index: 500;
}
.modal .close-button {
z-index: 100;
}
.modal header {
z-index: 50;
}
.modal footer {
z-index: 10;
}
.goku {
z-index: 9001;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment