Skip to content

Instantly share code, notes, and snippets.

@DavidQL
Created November 15, 2010 21:11
Show Gist options
  • Save DavidQL/700960 to your computer and use it in GitHub Desktop.
Save DavidQL/700960 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