1.0.2 • Published 5 days ago

dom-zindex v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 days ago

z-index 管理器

English | 简体中文

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

Web 通用的 z-index style 管理器

Browser Support

IEEdgeChromeFirefoxOperaSafari
7+ ✔80+ ✔44+ ✔40+ ✔60+ ✔6+ ✔

安装

npm install dom-zindex

CDN

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

示例 1

import domZindex from 'dom-zindex'

// 获取页面中最大的 z-index
domZindex.getMax()

// 设置当前 z-index
domZindex.setCurrent(1000)

// 获取当前 z-index
domZindex.getCurrent() // 1000

// 获取下一级 z-index
domZindex.getNext() // 1001

// 获取次要的当前 z-index,次要的 z-index 始终会大于主要的 z-index
domZindex.getSubCurrent() // 2001

// 获取次要的下一级 z-index
domZindex.getSubNext() // 2002

示例 2

import domZindex from 'dom-zindex'

// 如果传入 z-index 小于全局,则自动获取下一个
let currZindex1 = 999
currZindex1 = domZindex.getCurrent(currZindex1) // 1000

// 如果传入 z-index 大于全局,则返回传入值
let currZindex2 = 1500
currZindex2 = domZindex.getCurrent(currZindex2) // 1500

License

MIT © 2019-present, Xu Liangzhan