jQuery animate backgroundColor

前端 未结 17 2116
醉梦人生
醉梦人生 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:39

    Try this one:

    jQuery(".usercontent").hover(function() {
        jQuery(this).animate({backgroundColor:"pink"}, "slow");
    },function(){
        jQuery(this).animate({backgroundColor:"white"}, "slow");
    });
    

    Revised way with effects:

    jQuery(".usercontent").hover(function() {
    
        jQuery(this).fadeout("slow",function(){
            jQuery(this).animate({"color","yellow"}, "slow");
        });
    });
    

提交回复
热议问题