简体   繁体   中英

How to have one fixed link that can scroll to each section in fullPage.js?

So I want a down arrow that's fixed to the bottom of the window to scroll down to each section. So I click it once and it scrolls me down to the first section, I click it again and it will take me to the next section, and so on.. How do I achieve this with fullPage.js?

<nav>
  <a>this is the arrow</a>
</nav>

<section id="one">
    <h1>ONE</h1>
</section>

<section id="two">
    <h1>TWO</h1>
</section>

<section id="three">
    <h1>THREE</h1>
</section>

<section id="four">
    <h1>FOUR</h1>
</section>

<section id="five">
    <h1>FIVE</h1>
</section>

As you are using fullPage.js you'll need to make use of fullPage.js functions such as moveSectioDown :

$('.arrow').on('click', fullpage_api.moveSectionDown);  

Example:

https://jsfiddle.net/zyxhwbrc/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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