Can jquery animations be chained programmatically?

前端 未结 4 1338
走了就别回头了
走了就别回头了 2021-01-24 20:46

I have this code:

jQuery(\'#flash\').animate({opacity: 0.35}, 200)
                .animate({opacity: 0}, 200)
                .animate({opacity: 0.35}, 200)
            


        
4条回答
  •  清歌不尽
    2021-01-24 21:18

    You can chain the animation using a loop if that's what you're looking for.

    var $flash = jQuery('#flash'), i;
    
    for (i = 0; i < 10; i++) {
        $flash = $flash.animate({opacity: 0.35}, 200)
                       .animate({opacity: 0}, 200);
    }
    

提交回复
热议问题