How jquery modifies the z-index value
This article mainly explains "jquery how to modify z-index value", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "jquery how to modify the z-index value" bar!
Jquery modify z-index value method: 1, use css () method, syntax "$(selector) .css (" z-index "," value ")"; 2, use attr () method, syntax "$(selector) .attr (" style "," z-index: value ")".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
In jquery, you can use the css () or attr () methods to modify the z-index value of an element.
The css () method sets one or more style properties of the selected element.
The attr () method sets the attribute value of the selected element.
Example:
Img {position: absolute; left: 0px; top: 0px; z-index:-1 } $(document) .ready (function () {$("button") .click (function () {/ / $("img") .css ("z-index") "1") $("img") .attr ("style", "z indexVone 1;");});}); This is a heading
Because the z-index of the image is-1, it appears after the text.
Change the z-index value so that the picture is in front of the text
Thank you for reading, the above is the content of "how to modify the z-index value of jquery". After the study of this article, I believe you have a deeper understanding of how to modify the z-index value of jquery, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!