I am trying to animate a bird wing (to flap a little bit up and down) using the below code:
$bird_wing_left = $(".bird_wing_left");
function rotate($bodysec) {
$bodysec.animate({
transform: "rotate(30deg)"
}, 0, function() {
$(this).css({
transform: "rotate(70deg)"
});
rotate($(this)) ;
});
}
rotate ($bird_wing_left) ;
.bird_wing_left {
margin: 50px ;
width: 100px ;
height: 100px ;
background: blue ;
}
<div class="bird_wing_left"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
However, the code doesn't loop. It would just rotate to 70 degrees and stop there. I called the function inside the function so I'm not sure why it's not looping.