微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jquery – 为什么z-index忽略位置:static?

看到这个评论 from jquery-ui
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned

我看到jquery的zIndex()如果元素是position:static则返回0.

位置上不支持z-index:static? (它适用于我的Chrome,没有测试跨浏览器)

解决方法

因为position:static表示“忽略左,上,z-index等所有定位指令”.
'z-index'
Value:      auto | <integer> | inherit
Initial:    auto
Applies to:     positioned elements

http://www.w3.org/TR/CSS21/visuren.html#z-index

An element is said to be positioned if its ‘position’ property has a value other than ‘static’.

http://www.w3.org/TR/CSS21/visuren.html#positioned-element

原文地址:https://www.jb51.cc/jquery/180484.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐