Solve errors z-index with a simple javascript
Nessun commento » HTML , Javascript , Open Source , Tips & Tricks No Comments »
There around a tiny javascript that will save many of your lives.
It is a function to be loaded in the head of the HTML page to obtain a progressive resettamento the z-index, and undo the problems of overlapping elements that often occurs when the page cohabit various dynamic elements mixed together - for example: drop-down menu PixoPoint type presentations and jQuery.
In similar situations, often regrettable mistakes occur evaluation of z-index by the browser - especially from IE7 - resulting in, for example, the disappearance of an annoying drop-down behind a slide presentation of jQuery.
This little script "miracle" will solve the problem.
Eye that the reset of the z-index takes place in a progressive manner from top to bottom, tenetene account when placing the div to not get the opposite effect to that intended!
<script lang="javascript">
$(function() {
var zIndexNumber = 1000;
$('div').each(function() {
$(this).css('zIndex', zIndexNumber);
zIndexNumber -= 10;
});
});
</script>







