Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery UI API – .zIndex()

jQuery UI API - .zIndex()

Category

Methods | UI Core

.zIndex() usage

**Description:** Gets the z-index of an element.

Returns:jQuery

.zIndex()

This method accepts no arguments.

.zIndex() The method is useful for finding an element's z-index regardless of whether it is set directly on the element or on an ancestor. To determine the z-index, the method starts at the specified element and walks up the DOM until it finds a positioned element with a z-index. If no such element is found, the method returns 0 values.

The method assumes that an element with a nested z-index does not have a 0 value for z-index. For example, given the following DOM, the inner element is treated as having no z-index because in Internet Explorer it is impossible to distinguish an 0 explicit value from no value.



.zIndex( zIndex ) usage

**Description:** Sets the z-index of an element.

Returns:Integer

.zIndex( zIndex )

Parameters Type Description
zIndex Integer The z-index to set.

This is equivalent to .css( "zIndex", zIndex )。