Created
June 1, 2012 16:29
-
-
Save jacksonfdam/2853366 to your computer and use it in GitHub Desktop.
jQuery Set DOM Element to Top View Z-Index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.mb_bringToFront= function(zIndexContext){ | |
var zi=1; | |
var els= zIndexContext && zIndexContext!="auto" ? $(zIndexContext): $("*"); | |
els.not(".alwaysOnTop").each(function() { | |
if($(this).css("position")!="static"){ | |
var cur = parseInt($(this).css('zIndex')); | |
zi = cur > zi ? parseInt($(this).css('zIndex')) : zi; | |
} | |
}); | |
$(this).not(".alwaysOnTop").css('zIndex',zi+=1); | |
return zi; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment