Skip to content

Instantly share code, notes, and snippets.

@amowu
Created October 24, 2016 02:03
Show Gist options
  • Select an option

  • Save amowu/bbe24dd3a800b5bb292114a654eb92b3 to your computer and use it in GitHub Desktop.

Select an option

Save amowu/bbe24dd3a800b5bb292114a654eb92b3 to your computer and use it in GitHub Desktop.
z-index management
// | ------------- | ------------ | ------------------------------------------ |
// | z-index range | content type | details |
// | ------------- | ------------ | ------------------------------------------ |
// | < 0 | Background | |
// | | Elements | |
// | ------------- | ------------ | ------------------------------------------ |
// | 0 - 4,999 | Main Content | Standard ad tags in place with regular |
// | | Standard Ads | content. Includes OBA Self Regulation |
// | | | Message (CLEAR Ad Notice) |
// | ------------- | ------------ | ------------------------------------------ |
// | 5,000 - | Expanding | The entire expandable ad unit should be |
// | 1,999,999 | Advertising | set within this range |
// | ------------- | ------------ | ------------------------------------------ |
// | 2,000,000 - | Floating | Over The Page ads (OTP’s) |
// | 2,999,999 | Advertising | |
// | ------------- | ------------ | ------------------------------------------ |
// | 3,000,000 - | Pop-up | Chat windows, message notifications |
// | 3,999,999 | Elements | |
// | ------------- | ------------ | ------------------------------------------ |
// | 4,000,000 - | Non-anchored | Survey recruitment panels |
// | 4,999,999 | Floating | |
// | | Elements | |
// | ------------- | ------------ | ------------------------------------------ |
// | 5,000,000 - | Expanding | Drop down navigation, site warnings, etc. |
// | 5,999,999 | Site | Only the expanding portion of navigation |
// | | Navigation | elements should be included on this level. |
// | | Elements | |
// | ------------- | ------------ | ------------------------------------------ |
// | 6,000,000 + | Full-page | Full-window Over-the-Page (OTP) ads and |
// | | Overlays | Between-the-Page ads IF they cover page |
// | | | content |
// | ------------- | ------------ | ------------------------------------------ |
$z-layers: (
"fullscreen": 9999999,
"dialog": 10004
);
@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...);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment