Execute complete function only once in jQuery animation?

前端 未结 5 2006
一向
一向 2021-01-24 03:08

I\'m trying to animate the font size of some text:

$(\"p\").delay(500).animate({
    \"font-size\": \"+=50\"
}, 1000, function() {
    alert(\"Done\");
})​;
         


        
5条回答
  •  时光取名叫无心
    2021-01-24 04:03

    Give the P-tag in question an ID and select that ID rather than every P tag on the page. Like here: http://jsfiddle.net/LR8uP/1/

    Or if you want to animate every P-tag but run the function only once, add a state variable, like here: http://jsfiddle.net/LR8uP/2/

提交回复
热议问题