问题
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.
I can provide a jsfiddle example if this is still unclear.
回答1:
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.
If you still want to do it with other plugins, then you would need to use fullpage.js with the option scrollBar:true
.
You have more information about it at the documentation.
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
.
来源:https://stackoverflow.com/questions/22139309/fullpage-js-scrolling