我不能放一些延迟/动画 [英] I can't put some delay/animation

查看:101
本文介绍了我不能放一些延迟/动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能可以在div中设置顶部,以显示通知. 现在我只想延迟此功能(效果),因为顶部"设置为快速,而且太可怕了.

I have a function to set a top in a div, for show the notices. Now i just want to put a delay to this function (effect), because the "top" is set to fast, and it's so horrible.

var rolarbaixo = function() {     
var newtop = $('.plugin-noticias-rolar').position().top - 80;
$('.plugin-noticias-rolar').css('top', newtop + 'px').delay( 800 );
}

我尝试使用.delay,但不起作用.

I tried to use .delay, but doesn't work.

有帮助吗?

推荐答案

我猜您想要的是 为保持平稳过渡,请尝试以下操作:

I gues what you want here is animate() to keep a smooth transition, try this:

var rolarbaixo = function() {     
  var newtop = $('.plugin-noticias-rolar').position().top - 80;
  $('.plugin-noticias-rolar').animate({top : newtop + 'px'},800);
}

这篇关于我不能放一些延迟/动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆