alvarotrigo / alvarotrigo/fullPage.js

browser back-button / history problem with first section due to missing anchor-hash.

Ouverte
#950 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug Help needed
Langage dominant
JavaScript
Étoiles
35.4k
Forks
7.1k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

First of all: great work. Thank you very much.

After fiddling around a bit with fullpage.js, I encountered a little problem which can be reproduced with your demo.

Assume we have 3 or more sections. When I scroll from the first section (0) to the second section (1) and I then decide to go back to the first section via browser back button, the browser back-button won't work. The first section is missing its anchor / hashtag.

I fiddled a bit around and thought I could use your afterLoad-callback to add the missing anchor like this, so the browser navigation buttons will work from the first section on:

``` javascript
afterLoad: function(anchorLink, index){
//using index
if(index == 1){
location.hash = 'section0';
}};
```

The problem I ran into was, afterLoad seems to work only from 2nd section on upwards. The principle was tried out with afterRender and works but isn't very usefull because of deeplinking and stuff...

So i guess I would need something along the lines of

``` javascript
afterRender: (anchorLink, index) {
//stuff
};
```

So one could check if the first section is active and if so give it the missing hashtag. Does that make sense to you or am I totally stupid? :D Is there a method to do this that I have overlooked?

Best regards
tripletto

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.