[英]fullpage.js moveTo() function
I'm trying to use the moveTo() function in fullpage.js that allows me to navigate to a particular section/slide, which looks like this: 我试图在fullpage.js中使用moveTo()函数,该函数使我可以导航到特定的部分/幻灯片,如下所示:
/*Scrolling to the section with the anchor link `firstSlide` and to the 2nd Slide */
$.fn.fullpage.moveTo('firstSlide', 2);
I'm trying to use this within the afterSlideLoad()
function, in an attempt to automatically cycle through the slides. 我试图在
afterSlideLoad()
函数中使用它,以尝试自动循环浏览幻灯片。 my code looks like this: 我的代码如下所示:
$.fn.fullpage({
anchors: ['home', 'gallery'],
afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex) {
if (anchorLink == 'gallery') {
if (slideIndex == 11) {
setTimeout(function() {
moveTo(2,0);
}, 1000);
} else {
setTimeout(function() {
moveTo(2, slideIndex + 1);
}, 1000);
}
}
});
Which doesn't appear to do anything, I've also tried moveTo('gallery', 1);
似乎什么也没做,我也尝试过
moveTo('gallery', 1);
any suggestions with where I am going wrong? 关于我要去哪里的任何建议?
As specified in the documentation you are linking , the function must be called like this: 根据您要链接的文档中的指定,必须像下面这样调用该函数:
$.fn.fullpage.moveTo('firstSlide', 2);
And not like you are doing it: 而且不像您这样做:
moveTo('firstSlide', 2);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.