我正在尝试在视口中为内容设置动画。但问题是,jquery(用于检查内容是否在视口中)不起作用,因为我也在使用 pagepiling.js(http://alvarotrigo.com/pagePiling/)。我不知道确切的原因,但我认为这可能是由于使用 pagepiling.js 的不同页面的位置造成了问题。有什么解决方案吗?(基本上,我想要这样的东西)
<link rel="stylesheet" type="text/css" href="animate.css" /> <!-- animate.css css3 library -->
<script src="viewportchecker.js"></script> <!-- viewportchecker plugin -->
<script type="text/javascript" src="jquery.pagepiling.min.js"></script>
<style>
.hidden{
opacity:0;
}
.visible{
opacity:1;
}
</style>
<script>
var deleteLog = false;
$(document).ready(function() {
$('#pagepiling').pagepiling({
menu: '#menu',
anchors: ['page1', 'page2', 'page3'],
sectionsColor: ['#bfda00', '#693575', '#2C3E50', '#51bec4'],
easing: 'linear'
});
});
jQuery(document).ready(function() {
jQuery('.post').addClass("hidden").viewportChecker({
classToAdd: 'visible animated fadeIn',
offset: 100
});
});
</script>
<div id="pagepiling">
<div class="section" id="section1">
<div class="intro">
<div class="post"> <!-- Post content goes here --> </div>
</div>
</div>
<div class="section" id="section2">
<div class="intro">
<div class="post"> <!-- Post content goes here --> </div>
</div>
</div>
</div>