Gem*_*mma 4 jquery alert delay
我正在尝试延迟警报,但无法使其工作,当#foo悬停并且大小增加时,它总是弹出:
$('#foo').hover(function() {
$(this).animate({width :'400px'}, 'slow');
},
function() {
$(this).delay(2000).animate({width :'40px'}, 'slow');
alert('Im an alert message');
});
Run Code Online (Sandbox Code Playgroud)
但我希望它只在#foo减少回原始状态后显示...
小智 6
如何使用回调?
$('#foo').hover(function () {
$(this).animate({
width: '400px'
}, 'slow');
}, function () {
$(this).delay(2000).animate({
width: '40px'
}, 'slow', function () { //callback function, which runs very next to .animate()
alert('Im an alert message');
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7941 次 |
| 最近记录: |