Home > Article > Web Front-end > How to query z-index with jquery
Jquery method to query the element "z-index": 1. Use the "$(element)" statement to obtain the specified element object; 2. Use the css() method to return the "z-index" attribute of the specified element Value, the syntax is "element object.css("z-index")".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
How jquery queries z-index
css() method sets or returns one or more style attributes of the selected element.
Return the value of the specified CSS property, the syntax is as follows:
css("propertyname");
The example is as follows:
This is a heading
![]()
由于图像的 z-index 是 -1,因此它在文本的后面出现。
Output result:
After clicking the button:
Recommended related video tutorials: jQuery video tutorial
The above is the detailed content of How to query z-index with jquery. For more information, please follow other related articles on the PHP Chinese website!