javascript - setInterval doesn't work on .css method (no looping) -


i'm using setinterval try rotate image every 3 seconds , using below code:

jquery:

$(document).ready(function(){     setinterval(function(){          $bird_wing_left.css({             transform: "rotate(30deg)"         }, 1000)     }, 3000); }); 

css:

.bird_wing_left {     background: rgba(0, 0, 0, 0) url("../images/bird_wing_left.png") repeat scroll 0 0;     height: 59px;     left: 17px;     position: absolute;     top: 66px;     width: 78px;     transition: 2s; } 

...but animation happens once , not every 3 seconds. if try method (not .css), it's ok. issue?

it's rotating to 30 degrees, not by 30 degrees. need keep track of how far it's rotated:

$(document).ready(function(){     var rotate = 0;     setinterval(function(){          rotate += 30;         $bird_wing_left.css({             transform: "rotate(" + rotate + "deg)"         }, 1000)     }, 3000); }); 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -