Sunday, 8 September 2013

Is there a way to increase the z-index of matched element by 1, without iteration?

Is there a way to increase the z-index of matched element by 1, without
iteration?

I have to increase the z-index by 1, of all span with class .page. There
can be more than 100 matched elements (NOT more than 150 in any case).
Right now I am iterating through each one of them and changing the z-index
via following code.
$('#mydiv span.page').each(function() {
var zi = parseInt($(this).css('z-index')) + 1;
$(this).css('z-index', zi);
});
Is there a better way to deal with it for better performance. I am using
jQuery.

No comments:

Post a Comment