Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Javascript snippet should be loaded "on page load" and it should attach itself to any elements on the page that are abusing z-index (anything over 999) and brings them back down to 99 by building a style element after the element found. Does not fix elements with inline !important styles, which are impossible to override.
//todo: needs to somehow use the .on function to attach to elements created after pageload
jQuery('[style*="z-index"]').each(function() {
var zi = $(this).css("z-index");
if(zi > 999){
newstyle = jQuery('<style class="zindex2big" type="text/css"> #''{ z-index=99 !important;} </style>').insertAfter(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment