{"id":108,"date":"2023-08-25T17:43:42","date_gmt":"2023-08-25T17:43:42","guid":{"rendered":"\/\/api.jqueryui.com\/1.9\/?p=108"},"modified":"2023-08-25T17:43:42","modified_gmt":"2023-08-25T17:43:42","slug":"zIndex","status":"publish","type":"post","link":"https:\/\/api.jqueryui.com\/1.9\/zIndex\/","title":{"rendered":".zIndex()"},"content":{"rendered":"<div class=\"toc\">\n<h4><span>Contents:<\/span><\/h4>\n<ul class=\"toc-list\">\n<li>\n<a href=\"#zIndex1\">.zIndex()<\/a><ul><li><a href=\"#zIndex\">.zIndex()<\/a><\/li><\/ul>\n<\/li>\n<li>\n<a href=\"#zIndex2\">.zIndex( zIndex )<\/a><ul><li><a href=\"#zIndex-zIndex\">.zIndex( zIndex )<\/a><\/li><\/ul>\n<\/li>\n<\/ul>\n<\/div><article id=\"zIndex1\" class=\"entry method\"><h2 class=\"section-title\">\n<span class=\"name\">.zIndex()<\/span><span class=\"returns\">Returns: <a href=\"http:\/\/api.jquery.com\/Types\/#Integer\">Integer<\/a><\/span>\n<\/h2>\n<div class=\"entry-wrapper\">\n<p class=\"desc\"><strong>Description: <\/strong>Get the z-index for an element.<\/p>\n<ul class=\"signatures\"><li class=\"signature\">\n<h4 class=\"name\"><a id=\"zIndex\" href=\"#zIndex\"><span class=\"icon-link\"><\/span>.zIndex()<\/a><\/h4>\n<ul><li><div class=\"null-signature\">This method does not accept any arguments.<\/div><\/li><\/ul>\n<\/li><\/ul>\n<div class=\"longdesc\" id=\"entry-longdesc\">\n\t\t\t<p>The <code>.zIndex()<\/code> method is useful for finding the z-index of an element, regardless of whether the z-index is set directly on the element or on one of its ancestors. In order to determine the z-index, this method will start at the specified element and walk up the DOM until it finds an element that is positioned and has a z-index set. If no such element is found, then the method will return a value of <code>0<\/code>.<\/p>\n\t\t\t<p>This method assumes that elements with nested z-indexes would not have a z-index of <code>0<\/code>. For example, given the following DOM the inner element will be treated as if it does not have a z-index set because it is impossible to differentiate between an explicit value of <code>0<\/code> and no value in Internet Explorer.<\/p>\n\t\t\t<div class=\"syntaxhighlighter xml\">\n\t<table>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td class=\"gutter\">\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n1\">1<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n2\">2<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n3\">3<\/div>\n\t\t\t\t\t\n\t\t\t\t<\/td>\n\t\t\t\t\n\t\t\t\t<td class=\"code\">\n\t\t\t\t\t<pre><div class=\"container\"><div class=\"line\"><code><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">&quot;z-index: -10;&quot;<\/span>&gt;<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">&quot;z-index: 0;&quot;<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/code><\/div><\/div><\/pre>\n\t\t\t\t<\/td>\n\t\t\t<\/tr>\n\t\t<\/tbody>\n\t<\/table>\n<\/div>\n\n\t\t<\/div>\n<\/div><\/article><article id=\"zIndex2\" class=\"entry method\"><h2 class=\"section-title\">\n<span class=\"name\">.zIndex( zIndex )<\/span><span class=\"returns\">Returns: <a href=\"http:\/\/api.jquery.com\/Types\/#jQuery\">jQuery<\/a><\/span>\n<\/h2>\n<div class=\"entry-wrapper\">\n<p class=\"desc\"><strong>Description: <\/strong>Set the z-index for an element.<\/p>\n<ul class=\"signatures\"><li class=\"signature\">\n<h4 class=\"name\"><a id=\"zIndex-zIndex\" href=\"#zIndex-zIndex\"><span class=\"icon-link\"><\/span>.zIndex( zIndex )<\/a><\/h4>\n<ul><li id=\"zIndex-zIndex-zIndex\">\n<div><strong>zIndex<\/strong><\/div>\n<div>Type: <a href=\"http:\/\/api.jquery.com\/Types\/#Integer\">Integer<\/a>\n<\/div>\n<div>The z-index to set.<\/div>\n<\/li><\/ul>\n<\/li><\/ul>\n<div class=\"longdesc\" id=\"entry-longdesc-1\">\n\t\t\t<p>This is equivalent to <code>.css( &quot;zIndex&quot;, zIndex )<\/code>.<\/p>\n\t\t<\/div>\n<\/div><\/article>","protected":false},"excerpt":{"rendered":"<p>Get the z-index for an element.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,9],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-methods","category-ui-core"],"_links":{"self":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":1,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts\/108\/revisions\/109"}],"wp:attachment":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}