DEV Community

Discussion on: z-index; Tackling this tiny beast.

Collapse
 
rediahila profile image
Ali Haider

I made a mixin for that

$z-indexes: (
"header",
"results",
"thumbnail",
"SearchBarBtn",
"mainPageBlocks",
"searchBlock",
"lazyThumb",
"bgSvg"
);

@function z($name) {
@if index($z-indexes, $name) {
@return (length($z-indexes) - index($z-indexes, $name)) + 1;
} @else {
@warn 'There is no item "#{$name}" in this list; choose one of: #{$z-indexes}';
@return null;
}
}

Collapse
 
ridhikgovind profile image
Ridhik Govind

This will come handy someday ! Thank you !