jQuery:slideUp.delay.slideDown - 使用按钮取消?
我不明白为什么这行不通。
function notificationBoxOutput(type, message) {
var noteBox = $('.notificationBox');
noteBox.slideDown( function() {
noteBox.delay(2500).slideUp();
});
}
function notificationBoxCancel() {
console.log('successfully fired');
$('.notificationBox').slideUp();
}
因此,我调用函数 notificationBoxOutput
来在屏幕顶部添加一个提供一些反馈的状态栏。条向下滑动,保持 2.5 秒,然后向上滑动。
该栏本身包含一个更近的图标,单击时会触发 notificationBoxCancel
。因此,用户可以以比 2.5 秒更快的速度关闭栏。然而,更接近的方法不起作用。控制台显示“成功触发”,但盒子没有 slipUp()。 hide() 确实有效! fadeOut() 和 SlideUp() 则不然。
知道为什么吗?
i don't get why this won't work.
function notificationBoxOutput(type, message) {
var noteBox = $('.notificationBox');
noteBox.slideDown( function() {
noteBox.delay(2500).slideUp();
});
}
function notificationBoxCancel() {
console.log('successfully fired');
$('.notificationBox').slideUp();
}
So I call the function notificationBoxOutput
to have kind of statusbar on top of the screen that gives some feedback. The bar slidesDown, holds 2,5 secs and then slides up.
The bar itself contains a little closer-icon that fires notificationBoxCancel
on click. So the user has the possibility to close the the bar even faster then 2.5 secs. However the closer doesn't work. The console says "successfully fired", but the box doesn't slideUp(). hide() does work! fadeOut() and slideUp() doesn't.
Any idea why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该在向上滑动之前
.stop()
动画。尝试这样的事情:You should
.stop()
animations before you slide(them)Up. Try something like this:我认为这是因为动画已排队。尝试在
slideUp
之前调用stop
:I think it's because animations are queued. Try to call
stop
beforeslideUp
: