Skip to content

mcarlucci/layercake

Folders and files

NameName
Last commit message
Last commit date
Nov 22, 2018
Nov 22, 2018
Nov 10, 2018
Nov 7, 2018
Nov 7, 2018
Oct 29, 2018
Nov 7, 2018
Oct 30, 2018
Oct 29, 2018
Nov 7, 2018
Nov 22, 2018
Oct 29, 2018
Nov 22, 2018
Nov 9, 2018
Feb 2, 2020
Nov 22, 2018
Oct 29, 2018

Repository files navigation

Layercake.js


npm version minified size gzipped size hits per month gzipped size share on twitter


Demo

Layercake.js

Layercake.js is a zero dependency javascript plugin that automatically manages the z-index css property of the elements on your page based on user interaction (mutations to the DOM). Layercake.js will determine which element should have the higher z-index and increment/decrement it accordingly.

Installation

Include the following script before the closing </body> tag:

<script src="https://cdn.jsdelivr.net/npm/layercake-js@latest/dist/layercake.min.js"></script>

Usage

Add the data-layercake-layer data attribute, as well as a position property of absolute, relative or fixed to each html element you want to be managed by Layercake.js.

Note: Elements with CSS computed properties of display: none; or visibility: hidden; will not be tracked by Layercake.js.

Example:

<style>
  #popup {
    position: absolute;
  }
</style>

<div id="popup" data-layercake-layer>
  Hi! I am a popup overlay managed by Layercake.js!
</div>