jQuery UI API - .zIndex()

Category

Methods | UI Core

.zIndex() Usage

Description:Get the z-index for an element.

Returns:jQuery

.zIndex()

This method does not accept any arguments.

.zIndex()The method is useful when finding an element's z-index, regardless of whether the z-index is set directly on the element or on an ancestor element. 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 a0value.

This method assumes that elements with nested z-index do not have a0z-index value. For example, given the following DOM, the inner element will be treated as having no z-index, because in Internet Explorer it is impossible to distinguish an0explicit value and no value.

<div style="z-index: -10;">
  <div style="z-index: 0;"></div>
</div>

.zIndex( zIndex ) Usage

Description:Set the z-index for an element.

Returns:Integer

.zIndex( zIndex )

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

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

Other Extensions