0

为什么这不起作用

$('#upload-title').css({ background: '#ffffff' }).delay(800).css({ background: '#00FF72' });

我想要我的#upload-title。为白色 0.5 秒。感谢帮助

4

4 回答 4

8

delay方法延迟效果队列中的内容,并且css不是效果方法。

您可以css使用以下方法将呼叫添加到队列中queue

$('#upload-title').css({ background: '#ffffff' }).delay(500).queue(function(){
  $(this).css({ background: '#00FF72' });
});

演示:http: //jsfiddle.net/Guffa/BxJ3Z/

于 2011-10-03T08:42:30.060 回答
1

.delay()适用于动画,使用 jquery 。animate()而是http://api.jquery.com/animate/

于 2011-10-03T08:40:05.413 回答
0

您需要使用超时,延迟用于动画:

$('#upload-title').css({
    background : '#eeeeff'
});
setTimeout(function() {
    $('#upload-title').css({
        background : '#00FF72'
    });
}, 800);
于 2011-10-03T08:43:04.520 回答
0

提琴手

$(function() {
    setTimeout(
        function() {
            $('#upload-title').css({
                background: '#00FF72'
            });
        }, 500
    );
})
于 2011-10-03T08:43:49.160 回答