看到这个评论
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
– @L_502_1@
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