onLeave (index, nextIndex, direction)
一旦用户离开了一个部分,转换到新的部分,这个回调就被触发。返回false将在发生之前取消移动。
参数:
index:离开部分的索引。从1开始。
nextIndex:目的地段的索引。从1开始。 监听要滚动的下一屏index
direction:它将取值up或down取决于滚动方向。
例:
var myFullpage = new fullpage('#fullpage', {
navigation: true,
navigationPosition: 'right',
onLeave: function(index, nextIndex, direction){
var video = $("#video").get(0);
if(nextIndex.index == 0){
video.play();
// console.log('播放视频')
}
}
});
参考:
https://blog.csdn.net/weixin_33824363/article/details/91917079