Home  >  Article  >  Web Front-end  >  How to query z-index with jquery

How to query z-index with jquery

WBOY
WBOYOriginal
2021-12-29 13:57:492158browse

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")".

How to query z-index with jquery

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

How to query z-index with jquery

由于图像的 z-index 是 -1,因此它在文本的后面出现。

Output result:

How to query z-index with jquery

After clicking the button:

How to query z-index with jquery

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn