fullpage.js silentMoveTo似乎不起作用?

问题描述 投票:1回答:1

我正在创建一个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

对我做错的任何提示?

javascript fullpage.js
1个回答
1
投票

不需要通过OnLeave / silentMoveTo这样做,只需将active类添加到我想要显示的幻灯片中。

根据https://github.com/alvarotrigo/fullPage.js/issues/522

© www.soinside.com 2019 - 2024. All rights reserved.