jQuery UI API - .zIndex()
Category
.zIndex() Usage
Description: Get the z-index of an element.
Returns: jQuery
This method does not accept any parameters.
The .zIndex()
method is useful for finding the z-index of an element, regardless of whether the z-index is set directly on the element or on an ancestor. To determine the z-index, the method starts at the specified element and traverses the DOM until it finds a positioned element with a z-index. If no such element is found, the method returns a value of 0
.
This method assumes that elements with nested z-index do not have a z-index value of 0
. For example, given the following DOM, the inner element will be treated as not having a z-index, because in Internet Explorer, it is not possible to distinguish an explicit value of 0
from no value.
<div style="z-index: -10;">
<div style="z-index: 0;"></div>
</div>
.zIndex( zIndex ) Usage
Description: Set the z-index of an element.
Returns: Integer
Parameter | Type | Description |
---|---|---|
zIndex | Integer | The z-index to be set. |
This is equivalent to .css( "zIndex", zIndex )
.