0
我想在滾動條更改上添加animate.css類,我的意思是當滾動放下div時應該使用動畫fadeInUp進行動畫製作,但動畫的速度應該較慢。我已經測試過jQuery animate()函數,但它不適合我。使用jQuery更改animate.css類的默認速度
$(document).ready(function(){
$(window).scroll(function(){
var scrolls = $(window).scrollTop();
if(scrolls > 900){//from top to 900px my div appears
$(".box-animate").animate({function(){
$(this).addClass("animated fadeInUp");
}
},3000);
}
});
});
我知道我的代碼中存在一些愚蠢的東西:)但我無法找到它?
你說得對,代碼有問題,jQuery的'animate()'動畫CSS值*(和其他東西)*,但是你不能只在內部粘貼一個'addClass',並且希望它可以工作,它不會。 – adeneo
$(this).addClass(「animated fadeInUp」)會產生問題,但是怎麼做呢? –