jQuery animate to transparent

前端 未结 9 1984
迷失自我
迷失自我 2021-01-18 06:05
$(\".block li\").hover(
    function(){
        $(this).animate({backgroundColor: \"#000\"});
    },
    function(){
        $(this).animate({backgroundColor: \"#fff         


        
9条回答
  •  既然无缘
    2021-01-18 06:40

    This may require some change to your HTML and CSS (which could be effected by script if you don't have direct HTML/CSS control).

    I would split each '.block li' element into two elements: one that will be the background element that can be animated with $.fadeTo(), and another element laid over the top that will contain your foreground content and on which you can call $.hover() with your handlers.

提交回复
热议问题