我使用的是基于javascript的模式对话框。对话框淡入淡出都很好,但是如果我想使用delay(3000)
将淡出延迟几秒钟,它就不能工作。它永远不会淡出。我能做错什么呢?这是一个MVC应用程序。
function testingh(button) {
alert("DfdfdfF");
$('.error-notification').remove();
var $err = $('<div>').addClass('error-notification')
.html('<h2>Paolo is awesome</h2>(click on this box to close)')
.css('left', $(button).position().left);
$(button).after($err);
$err.fadeIn('slow');
$err.delay(3000).fadeOut('slow');
}
如果你知道一个更有效的方法来delay(meaning postpone)
淡出,然后让我知道。使用delay(3000).fadeOut
对我来说似乎是最有效的?
CSS:
.error-notification {
background-color:#AE0000;
color:white;
cursor:pointer;
display: none;
padding:15px;
padding-top: 0;
position:absolute;
z-index:1;
font-size: 100%;
}
.error-notification h2 {
font-family:Trebuchet MS,Helvetica,sans-serif;
font-size:140%;
font-weight:bold;
margin-bottom:7px;
}
发布于 2010-10-11 22:26:43
setTimeout(function() {
$err.fadeOut()
}, 3000);
发布于 2010-10-11 22:31:15
而不是写作
$err.delay(3000).fadeout('slow');
试着写
$err.fadeout('4000');
发布于 2010-10-11 22:32:45
这是不是你必须队列链你的延迟?尝尝这个
$err.fadeIn('slow').delay(3000).fadeOut('slow');
https://stackoverflow.com/questions/3907075
复制相似问题