我有以下代码,它正在工作,但我想用 javascript 函数“自动化”它,所以我不必一遍又一遍地编写它。
$("#portfolio").waypoint(function() {
$('.portfolio-item').eq(0).css("animation-delay","0.0s");
$('.portfolio-item').eq(1).css("animation-delay","0.3s");
$('.portfolio-item').eq(2).css("animation-delay","0.6s");
$('.portfolio-item').eq(3).css("animation-delay","0.9s");
$('.portfolio-item').eq(4).css("animation-delay","1.2s");
$('.portfolio-item').eq(5).css("animation-delay","1.5s");
$('.portfolio-item').eq(6).css("animation-delay","1.8s");
$('.portfolio-item').eq(7).css("animation-delay","2.1s");
$('.portfolio-item').eq(8).css("animation-delay","2.4s");
$('.portfolio-item').addClass('animated fadeInUp');
}, { offset: 400});
谢谢!