alvarotrigo / fullPage.js

fullPage plugin by Alvaro Trigo. Create full screen pages fast and simple
http://alvarotrigo.com/fullPage/
GNU General Public License v3.0
35.04k stars 7.3k forks source link

Clear fitToSectionDelay when declaring setFitToSection(false) #4590

Open Rasande opened 6 months ago

Rasande commented 6 months ago

Is there a way to prevent a section to fit the screen when you declare fullpage_api.setFitToSection(false) during the delay period of fitToSectionDelay? As of now you have to wait for the delay to run out before it's disabled.

Using the demo from the documentation https://codepen.io/alvarotrigo/pen/GJXNYm and reproduce the following steps:

  1. Scroll down to the middle of the page
  2. Press "Turn off" within the delay period

The closest section still scrolls to the top even though I would assume the function is disabled.

fullPage.js v4.0.20

alvarotrigo commented 6 months ago

Unfortunately, that's not possible at the moment.

Any reason why you can't just disable it before the user scrolls?

Rasande commented 6 months ago

I understand, but thank you for the answer!

I was aiming to disable or enable it when the user scrolls past different parts of the page. But once it was enabled it had to fit to a section before it was disabled, no matter how long you scrolled for.

alvarotrigo commented 6 months ago

Maybe you can use the afterLoad callback or the onLeave callback for that?