문제

I need to shake div and animate its background-color color at the same time.

Here is the JSFiddle example: http://jsfiddle.net/EUz4z/

$("#test").effect("shake", {}, 500 ).css("background-color","red").animate({backgroundColor: old_bg}, 500 );
})
도움이 되었습니까?

해결책

You can use the queue: false option:

http://jsfiddle.net/ysFcD/

$(document).ready(function(){
    $("#but").click(function(){
        old_bg=$("#test").css("background-color");
        $("#test").effect("shake", {  }, 500 )
            .css("background-color","red")
            .animate({backgroundColor: old_bg}, {duration: 500, queue: false } );
    })
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top