Created
April 30, 2020 16:55
-
-
Save gruppjo/b114bb191db9874d74d0d8b94b8c34e3 to your computer and use it in GitHub Desktop.
Revisions
-
gruppjo created this gist
Apr 30, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ /* V1.1 based on Jonathan's Gist */ /* https://gist.github.com/gruppjo/b5c6389b1ef71369e815c95cb1b33813 */ // The z-index increases from top to bottom $zLayers: ( 'Buffer1', 'Buffer2', 'HomeHeader', 'MainNavigation', 'Modal' ); @function zIndex($layerName) { @return z($layerName); } @function z($layerName, $searchIn: $zLayers, $layer: null) { @for $i from 1 through length($searchIn) { $currentElement: nth($searchIn, $i); @if ($currentElement == $layerName) { @if ($layer == null) { $layer: index($searchIn, $layerName); } @return $layer; } } @if ($searchIn == $zLayers) { @error "No z-index found for #{$layerName}. Property omitted."; } @return null; }