【发布时间】:2017-01-20 09:55:20
【问题描述】:
如何通过使用与 GSAP 插件集成的 fullPage.js 来实现这种website?尝试了几次,我对 jQuery 代码不是很清楚。
顺序是:
-页面加载时动画开始
-向下滚动时,动画反转将首先触发,直到完成,然后跳转到下一部分。
-动画在第二部分页面加载时开始
--向上滚动到第二段时,动画反转会先触发,直到结束,然后跳转到上一段。
--向下滚动到第二部分时,动画反转会先触发,直到完成,然后跳转到下一部分。
感谢您对此事的善意建议。
不开心的reproduction demo。
var head = $("#one h1"),
head2 = $("#two h1");
tl = new TimelineLite();
$("#reverse").click(function(){tl.reverse();});
$("#restart").click(function(){tl.restart();});
$('#fullpage').fullpage({
sectionsColor: ['darkgrey', 'grey', 'lightgrey'],
scrollingSpeed: 1000,
afterLoad: function(anchorLink, index) {
var loadedSection = $(this);
if (index == 1) {
$(head2).hide();
tl.staggerFrom(head, 0.2, {scale: 0,autoAlpha: 0}, 0.5)
}
if (index == 2) {
tl.staggerFrom(head2, 0.2, {scale: 0,autoAlpha: 0}, 0.5)
}
},
onLeave: function(index, nextIndex, direction) {
var leavingSection = $(this);
if (index == 1 && direction == 'down') {
//tl.reverse(head, 0.2, {scale: 0,autoAlpha: 0}, 0.5);
$(head2).show();
} else if (index == 2 && direction == 'up') {
$(head2).hide();
//tl.restart(head, 0.2, {scale: 0,autoAlpha: 0}, 0.5);
}
}
});
【问题讨论】:
-
你遇到了什么问题?
标签: jquery fullpage.js gsap