-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- HTML5 History API Feature #3870
base: dev
Are you sure you want to change the base?
Conversation
First version of HTML5 History API Feature TODO: Documentation
The .htaccess from vue router works fine to redirect sections, but static resources need to be called with a prefix / (root-relative) in order to work fine for sub-sections
Anyway this .htaccess performs better because it does not search for all files, but the user needs to customize which directories he has in his project. (contributed by @mrwhite from SO)
|
I still don't have time to look into this issue but I'll definitely do for a future release! |
@alvarotrigo Hello hope you are doing fine. With the second .htaccess everything works as expected, except anchors (anchors created by fp-nav work as expected) Can you point me to which function controls anchor navigation? I can fix it. Thanks in advance. |
I'm not quite sure what you mean by anchors. |
I mean if the developer creates an anchor inside any section or even outside the fullpage: Given the next structure (#historyMenu is a fixed element):
the anchors from #historyMenu don't work exactly as they should, they toggle between the destination clicked and the first section: for example if you are currently in #section2 (mysection2) and then click the menu to go to #section3 (mysection3) you are taken to #section1 (mysection1) then if you click the same button again, now you go to #section3 (mysection3) This is even more problematic if the navigation isn't fixed because you are always taken to the first section. |
It works in current version of fullpage. If not then provide a reproduction online to better understand what you mean. |
@alvarotrigo check dev.urbanbeast.co Click mysection1, it will take you to the right place, then click mysection1/myslide1 wrongly it will take you to the first section, click again mysection1/myslide1 now it will take you to the right place. The code is vanilla, using examples/examples.css and src/fullpage.css src/fullpage.js (with history modification) I sent you ftp credentials through your website form. |
Thanks. I'll investigate that whenever I check the pull request and the resulting code. |
I can solve it too, but I still haven't had time to fully check the fullpage.js code. For now I solved it by preventing the default action of clicks, and then using fullpage_api to move to the right section.
|
Just did some testing. If you have it on a page at |
First version of HTML5 History API Feature #3687 #2131 #950
TODO:
Some refactoring could be done:
Integrate ApiStateFromUrlString() with getAnchorsURL()
Integrate ApiScrollToPath() with scrollToAnchor()
ApiPushRecord() needs a way to detect if we are already in a section with a slide, and only change the slide part of the url, so we can drop the / in the url argument (used to avoid duplicate entries of the section when there are slides). In this way we can put index.html anywhere instead of only on the root of our server. (we can compare the parameter that was passed to the function with window.location.pathname)
setState() already creates the url for setUrlHash(), but dunno if it just should use an object as parameter (like the one from getAnchorsUrl() )to invoke the functions ApiPushRecord or setUrlHash and each of those functions build the URL as their needs