user2154508
user2154508

Reputation: 345

I can't put some delay/animation

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 );
}

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

Any help?

Upvotes: 0

Views: 65

Answers (1)

DaniP
DaniP

Reputation: 38252

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);
}

Upvotes: 1

Related Questions