Question

I am now trying to put the fullpage plugin into my website (https://github.com/alvarotrigo/fullPage.js)

Everything just works fine except there is a refresh problem. (it might not be a problem for everyone)

The problem is:

After I scrolled to the third page(section), I refresh my website. It will then go back to my first page (the first section on the top) and automatically scroll down to the third page again.

What I really want instead is to go back and stop at my first page every time after I refresh my website.

I have included this code in my js file,

window.onload = function() {
    setTimeout (function () {
        scrollTo(0,0);
}, 0);}

but seems like it is not working.

Can anyone help me with this issue? Thank you

Was it helpful?

Solution

You are using anchor links in the URL (#) and therefore every time you access a page with an anchor link, it will redirect you to the section or slide it corresponds. This is the purpose of anchor links in any site apart from adding extra info to the user.

You could only do what you want by using the plugin without anchor links. (So the URL will always be the same no matter in which section or slide you are in)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top