Skip to content

Instantly share code, notes, and snippets.

@addyosmani
Forked from DavidQL/pushTop.js
Created November 30, 2010 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save addyosmani/721239 to your computer and use it in GitHub Desktop.
Save addyosmani/721239 to your computer and use it in GitHub Desktop.
(function( $ ){
$.fn.pushTop = function() {
return this.each(function() {
var $this = $(this);
top_z_index = 0;
$('*').each(function() {
var this_z_index = $(this).css('z-index');
if (this_z_index != "auto" && this_z_index > top_z_index) {
top_z_index = this_z_index;
}
});
top_z_index++;
$this.css('z-index',top_z_index);
});
};
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment