When the user scrolls anywhere, I need to: 1. stop scrolling 2. animate out the stuff in section 3. trigger the scroll then.
Everything I found is stopping scrolling by returning onLeave
callback false
. But in this case I can't trigger the scroll later.
new fullpage('#fullpage', {
licenseKey: 'OPEN-SOURCE-GPLV3-LICENSE',
sectionsColor: ['yellow', 'orange', '#C0C0C0', '#ADD8E6'],
onLeave: (origin, destination, direction) => {
// This disables scroll, but eliminates all
// the code below too. This is the only way
// to disable scroll I found in documentation.
return false;
// Here I suppose to do my animations
(() => {
$('.section').text('My fancy animations! Whoa!');
})();
// And nooow I need to resume the scroll as such
$('section *').one('webkitAnimationEnd oAnimationEnd msAnimationEnd animationend', () => {
if(direction === 'down') {
fullpage_api.moveSectionDown();
} else {
fullpage_api.moveSectionUp();
}
});
}
});
.section {
text-align:center;
font-size: 3em;
}
<script src="https://rawgit.com/alvarotrigo/fullPage.js/dev/src/fullpage.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="fullpage">
<div class="section">Section 1</div>
<div class="section">Section 2</div>
<div class="section">Section 3</div>
<div class="section">Section 4</div>
</div>