dom-zindex
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

z-index Manager

English | 简体中文

npm version npm downloads issues issues closed pull requests pull requests closed npm license

Web common z-index style management.

Browser Support

IE Edge Chrome Firefox Opera Safari
7+ ✔ 80+ ✔ 44+ ✔ 40+ ✔ 60+ ✔ 6+ ✔

Installing

npm install dom-zindex

CDN

<script src="https://unpkg.com/dom-zindex"></script>

Example 1

import domZIndex from 'dom-zindex'

// Gets the largest z-index on the page.
domZIndex.getMax()

// Set main current z-index.
domZIndex.setCurrent(1000)

// Get main current z-index.
domZIndex.getCurrent() // 1000

// Get main next z-index.
domZIndex.getNext() // 1001

// Get subordinate current z-index, the secondary z-index will always be greater than the primary z-index.
domZIndex.getSubCurrent() // 2001

// Get subordinate next z-index.
domZIndex.getSubNext() // 2002

Example 2

import domZIndex from 'dom-zindex'

// If the incoming z-index is less than global, the next one is automatically fetched.
let currZIndex1 = 888
currZIndex1 = domZIndex.getCurrent(currZIndex1) // 1000

// If the z-index is greater than the global value, the value is returned.
let currZIndex2 = 2000
currZIndex2 = domZIndex.getCurrent(currZIndex2) // 1500

Contributors

Thank you to everyone who contributed to this project.

dom-zindex

License

MIT © 2019-present, Xu Liangzhan

Readme

Keywords

Package Sidebar

Install

npm i dom-zindex

Weekly Downloads

7,653

Version

1.0.4

License

MIT

Unpacked Size

20.7 kB

Total Files

9

Last publish

Collaborators

  • x-extends