How do I animate a background color to transparent in jQuery?

后端 未结 12 1768
慢半拍i
慢半拍i 2020-12-09 14:46

I can animate from transparent to color, but when I tell jquery to animate the backgroundColor: \'transparent\' it just changes to white. Any idea how to fix this?

12条回答
  •  感情败类
    2020-12-09 15:17

    I used the function parameter to remove the style after the animation was done:

    $('[orgID=' + orgID + 'bg]').animate({ backgroundColor: "white" }, 300, "linear", function()
     {
         $('[orgID=' + orgID + 'bg]').css('background-color', '');
    });
    

    It worked great.

提交回复
热议问题