简体   繁体   English

fullPage.js onLoad回调吗?

[英]fullPage.js onLoad callback?

I've been using fullPage.js for a project and there's an event that I need to execute AS SOON as the next section is loaded (not after it has finished loading). 我一直在将fullPage.js用于一个项目,并且有一个事件需要在下一节加载时立即执行(不是在完成加载后)。 Is there a way to do this? 有没有办法做到这一点? I can't seem to find something like that in the documentation . 我似乎在文档中找不到类似的内容

The only callbacks listed are: 列出的唯一回调是:

  • afterLoad (anchorLink, index) afterLoad(anchorLink,索引)
  • onLeave (index, nextIndex, direction) onLeave(索引,nextIndex,方向)
  • afterRender() AfterRender阶段()
  • afterResize() afterResize()
  • afterSlideLoad (anchorLink, index, slideAnchor, slideIndex) afterSlideLoad(anchorLink,index,slideAnchor,slideIndex)
  • onSlideLeave (anchorLink, index, slideIndex, direction) onSlideLeave(anchorLink,索引,slideIndex,方向)

The main idea would be to add a class to an element as soon as I'm moving to another section. 我的主要思想是在我移至另一部分后立即将一个类添加到元素。 If there isn't a callback predefined to do so, which would be the best way? 如果没有预定义的回调方法,那将是最好的方法?

Use onLeave : 使用onLeave

onLeave (index, nextIndex, direction) This callback is fired once the user leaves a section, in the transition to the new section. onLeave(索引,nextIndex,方向)一旦用户离开某个部分(在向新部分的过渡中),就会触发此回调。

Using the nextIndex parameter you can do what you want to achieve. 使用nextIndex参数,您可以执行想要的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM