js fiddle for what I want to achieve : http://jsfiddle.net/g3qgS/1/
The image of sun rises from bottom and then using jquery rotate, its being rotated till 360 degrees. These 2 animations run fine in chrome, FF, IE9 but not in IE8.
In IE8, the sun will rise from bottom till the point where it is supposed to , then before the rotation, it comes back to its original position and rotates.
I am using jquery rotate plugin (http://code.google.com/p/jqueryrotate/) for this, I know this can also be done through css3, but I needed it for IE8 as well, hence had to go this way.
Any help on why its behaving weird in IE8 would be appreciated. In fact, if there's another way to do these animations, would be glad to know, provided they work in IE8 as well. Thank you.
HTML:
<div class="cont">
<img src="http://s22.postimg.org/fjo3h0p2l/sun.png" class="sun"/>
</div>
CSS:
.cont {background:#000; height:345px; position:relative;}
.sun {position:absolute; bottom:0px; left:20px;}
js:
$(window).load(function () {
HomePageAnimation.sunRise();
});
var HomePageAnimation = {
sunRise: function () {
$(".sun").animate(
{ "bottom": "150px" },
{ duration: 2000,
complete: function () { HomePageAnimation.rotateSun(360) }
});
},
rotateSun: function (angle) {
var sun = $(".sun")
sun.rotate({
angle: 90,
animateTo: 360
});
}
};