I tried jQuery's
$('#divOne').animate({zIndex: -1000}, 2000)
to that element which has a z-index of 1000, but it is still above the other elements?
(If I use firebug to change it to -1000
then it will be below other elements)
I tried jQuery's
$('#divOne').animate({zIndex: -1000}, 2000)
to that element which has a z-index of 1000, but it is still above the other elements?
(If I use firebug to change it to -1000
then it will be below other elements)
You cannot animate the zindex.You can set it using .css.$("#divOne").css('z-index' , '-1000');
jQuery attempts to add a unit to the value on each step of the animation. So, instead of
99
it'll be99px
which, of course, isn't a validzIndex
value.It doesn't seem possible to set the unit used by jQuery to simply a blank string -- it'll either take the unit you include in the value (e.g.
20%
- percent unit) or it will usepx
.Fortunately, you can hack
animate()
to make this work:For more info about
~~
see this.