jQuery animate backgroundColor

前端 未结 17 2115
醉梦人生
醉梦人生 2020-11-21 07:11

I am trying to animate a change in backgroundColor using jQuery on mouseover.

I have checked some example and I seem to have it right, it works with other properties

17条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-21 07:53

    If you wan't to animate your background using only core jQuery functionality, try this:

    jQuery(".usercontent").mouseover(function() {
          jQuery(".usercontent").animate({backgroundColor:'red'}, 'fast', 'linear', function() {
                jQuery(this).animate({
                    backgroundColor: 'white'
                }, 'normal', 'linear', function() {
                    jQuery(this).css({'background':'none', backgroundColor : ''});
                });
            });
    

提交回复
热议问题