【发布时间】:2014-08-13 09:10:10
【问题描述】:
您好,我正在使用这个名为 animate.css 的插件。
http://daneden.github.io/animate.css/
我已经成功实现了动画.. 我有 6 个图标。我希望他们以延迟 1 秒的顺序依次制作动画。我无法实现动画延迟。这一切都是一次动画。请帮忙。
这是 Html 代码。
<ul class="top_feat">
<li><img src="images/cc.png" class="revealOnScroll " data-animation="zoomIn" ></li>
<li>Covered Car Park</li>
</ul>
<ul class="top_feat">
<li><img src="images/club_house.png" class="revealOnScroll" data-animation="zoomIn" ></li>
<li>Club House</li>
</ul>
<ul class="top_feat">
<li><img src="images/gym.png" class="revealOnScroll " data-animation="zoomIn" ></li>
<li>Gymnasium</li>
</ul>
<ul class="top_feat">
<li><img src="images/rec_hall.png" class="revealOnScroll " data-animation="zoomIn" ></li>
<li>Recreation Hall</li>
</ul>
这是它的 jquery。
<script>
$(function() {
var $window = $(window),
win_height_padded = $window.height() * 1.1,
isTouch = Modernizr.touch;
if (isTouch) { $('.revealOnScroll').addClass('animated'); }
$window.on('scroll', revealOnScroll);
function revealOnScroll() {
var scrolled = $window.scrollTop(),
win_height_padded = $window.height() * 1.1;
// Showed...
$(".revealOnScroll:not(.animated)").each(function () {
var $this = $(this),
offsetTop = $this.offset().top;
if (scrolled + win_height_padded > offsetTop) {
if ($this.data('timeout')) {
window.setTimeout(function(){
$this.addClass('timeout');
}, parseInt($this.data('timeout'),10));
} else {
$this.addClass('animated ' + $this.data('animation'));
}
}
});
// Hidden...
$(".revealOnScroll.animated").each(function (index) {
var $this = $(this),
offsetTop = $this.offset().top;
if (scrolled + win_height_padded < offsetTop) {
$(this).removeClass('animated fadeInUp flipInX lightSpeedIn')
}
});
}
revealOnScroll();
});
</script>
谢谢。
【问题讨论】:
-
你可以看看delay.css:github.com/Simonn-/delay.css
-
非常感谢!这就像一个魅力!
标签: jquery css jquery-animate delay