javascript - fullpage.js silentMoveTo 似乎不起作用?
问题描述
我正在创建一个 fullpage.js 站点,我需要在其中滚动幻灯片以在特定幻灯片上查看。像这样:
1
X2X
3
4
X2X 是 3 张幻灯片,我想降落在第 2 张幻灯片上,以便用户可以向左或向右。
我习惯OnLeave
打电话silentMoveTo
,但无论我做什么似乎都没有生效:
onLeave: function(origin, destination, direction) {
var params = {
origin: origin,
destination: destination,
direction: direction
};
//after leaving first section
console.log("leaving...");
if (origin.index == 0 && direction == "down") {
// moves the slides to the 2nd slide
console.log("fire after 1?");
fullpage_api.silentMoveTo(1, 1);
}
}
但silentMoveTo
不起作用。这是一个 CodePen https://codepen.io/thetwopct/pen/bZwyRw
关于我做错了什么的任何提示?
解决方案
不需要通过 OnLeave/silentMoveTo 执行此操作,只需active
向我要展示的幻灯片添加类即可。
推荐阅读
- ruby - 我可以通过 ruby-git 获取上游远程分支吗
- sql - Postgresql - 将数据库中不同模式的表值合并到一个表中
- javascript - Angular中用户的指纹认证| Python
- jenkins - 无法在 Jenkins 和 newman 的 Git hub 存储库的嵌套文件夹中运行 Postman 集合
- haskell - Haskell如何附加自定义数据
- python - 当资源不可用时有效处理从 __enter__ 引发的 python 异常
- firebase - Firestore 安全设置规则中的“request.resource.auth”与“request.auth”有什么不同?
- javascript - 有没有办法通过我的应用程序中的“onPress()”事件在手机设备背景中打开像 Facebook 这样的应用程序?
- php - 如何在 laravel livewire 中应用 select2 与多个刀片文件中的 1 个组件
- react-redux - TypeError:无法读取未定义倒计时反应循环计时器的属性“地图”