为什么这不起作用
$('#upload-title').css({ background: '#ffffff' }).delay(800).css({ background: '#00FF72' });
我想要我的#upload-title。为白色 0.5 秒。感谢帮助
为什么这不起作用
$('#upload-title').css({ background: '#ffffff' }).delay(800).css({ background: '#00FF72' });
我想要我的#upload-title。为白色 0.5 秒。感谢帮助
该delay方法延迟效果队列中的内容,并且css不是效果方法。
您可以css使用以下方法将呼叫添加到队列中queue:
$('#upload-title').css({ background: '#ffffff' }).delay(500).queue(function(){
$(this).css({ background: '#00FF72' });
});
演示:http: //jsfiddle.net/Guffa/BxJ3Z/
.delay()适用于动画,使用 jquery 。animate()而是http://api.jquery.com/animate/
您需要使用超时,延迟用于动画:
$('#upload-title').css({
background : '#eeeeff'
});
setTimeout(function() {
$('#upload-title').css({
background : '#00FF72'
});
}, 800);
$(function() {
setTimeout(
function() {
$('#upload-title').css({
background: '#00FF72'
});
}, 500
);
})