각 스팬을 3 초 간격으로 임의의 색상으로 회전하려고합니다.jQuery 컬러 애니메이션의 로딩 시간 단축
JSFiddle : http://jsfiddle.net/WERFJ/21/
<h1><span class="first">TEXT1</span> <span class="second">TEXT2</span> <span class="third">TEXT3</span></h1>
가 현재 나는 아래의 코드와 jquery.animate-colors 플러그인을 사용하고 있습니다. 이 방법을 실행하거나 동일한 효과를 더 빨리 얻을 수있는 방법이 있습니까? Chrome이 처리 할 수 있지만 FF가 자주 중단됩니다. 감사!
$(document).ready(function() {
spectrum();
function spectrum(){
var hue1 = 'rgb(' + 128 + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
var hue2 = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + 128 + ',' + (Math.floor(Math.random() * 256)) + ')';
var hue3 = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + 128 + ')';
$('.first').animate({ color: hue1 }, 3000);
$('.second').animate({ color: hue2 }, 3000);
$('.third').animate({ color: hue3 }, 3000);
spectrum();
}
});
나는 당신의 문제는 애니메이션이 끝날 때까지 재귀 호출 대기되지 않는다는 생각 – georgephillips