요소를 업데이트 할 때 배경색을 변경하려고합니다.jquery를 사용하여 업데이트 할 때 배경색 변경
서버에서 응답이 돌아 오면 초당 요소의 배경색을 변경 한 다음 원본으로 다시 변경하고 싶습니다. 배경색을 변경할 수는 있지만 동일한 호출에서 다시 변경할 수는 없습니다.
$.each(theArray,function(intIndex,objValue){
$("#" + objValue.id).parent().css('background-color','red');
});
//NEED TIMING EVENT FOR DELAY
$.each(theArray,function(intIndex,objValue){
$("#" + objValue.id).parent().css('background-color','transparent');
});
첫 번째 루프는 잘 작동하지만 난 다른 하나는 동작하지 않습니다 : 여기에
는 내가 지금까지 가지고있는 것입니다. 나는 이런 식 시도 :$.each(theArray,function(intIndex,objValue){
$("#" + objValue.id).parent.css('background-color','red').delay(1000).css('background-color','transparent');
});
을하고 그 중 하나가 아무것도하지 않았다.
그래서 문제가 무엇인지 잘 모르겠습니다. 어떤 제안?
좋은 예 조셉과 편집 해 주셔서 감사합니다. 좋은 catch – veeTrain
그게 전부 야. 'setTimeout()'으로 시도했지만 변수를 사용하지 않았습니다. 감사. –
요셉; 이것은 정말 잘 작동합니다. 큐/큐 풀 접근 대신 개인적으로 구현했습니다. – veeTrain