Sunday, November 20, 2011

IE7 Z-Index Issues

IE7 has a problem rendering z-indexes unpredictable orders. I had an absolutely positioned div and under it I had a another absolutely positioned element.Element stacked according to source order thought z-index you give more to first element.
To resolve this issue use blow conditional code for ie7. This code will start with a z-index of 1000, and decrement the z-index for each DIV element of the page by 10, giving the first DIV a z-index of 1000, the second, 990, the third 980, and so on.
$(function() {
var zIndexNumber = 1000;
$(‘div’).each(function() {
$(this).css(‘zIndex’, zIndexNumber);
zIndexNumber -= 10;
});
});

No comments: