FullPage.JS滚动 [英] FullPage.JS Scrolling
问题描述
我的问题涉及fullpage.js对(window).scroll
事件的响应.我试图让我的应用程序更改滚动条上的导航栏,但是我无法让我的网站记录任何滚动条事件.我尝试了以下问题,例如:在滚动条上的导航栏中设置动画.当我将autoScrolling: false
选项添加到整页时,它可以解决此问题,但是我宁愿不使用该选项.我想利用简单的滚动动作来移动整个页面.
My question involves fullpage.js responding to (window).scroll
events. I'm trying to have my application change the navbar on a scroll, but I can't get my site to log any of the scroll events. I tried following questions like: Animate in Nav bar on scroll. When I add the autoScrolling: false
option to fullpage, it remedies the issue, but I would rather not use that option. I want to take advantage of the simple scroll action moving the entire page.
如果仍然不清楚,我可以提供一个jsfiddle示例.
I can provide a jsfiddle example if this is still unclear.
推荐答案
您最好使用插件提供的回调,例如 afterLoad
.
这样一来,当您从一张幻灯片转到另一张幻灯片时,您便可以执行触发动作.
You should better use the callbacks provided by the plugin such as onLeave
and afterLoad
.
That would give you the power of firing actions when going from one to another slide.
如果您仍然想与其他插件一起使用,则需要使用带有scrollBar:true
选项的fullpage.js.
If you still want to do it with other plugins, then you would need to use fullpage.js with the option scrollBar:true
.
您可以在文档中有关此信息.
您无法通过使用scroll
事件触发任何操作的原因是,该插件并未真正滚动页面,而只是更改了站点包装程序的top
属性,或者添加了该属性translate3d
选项css3:true
的说明.
The reason you can not fire any action by using the scroll
event is because the plugin doesn't really scroll the page but just change the top
property of the site wrapper or add the property translate3d
in case of using the option css3:true
.
这篇关于FullPage.JS滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!