-
Notifications
You must be signed in to change notification settings - Fork 249
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
Using anchors tags with navigo #111
Comments
In theory it should be possible if we don't use the hash based routing. If only the browser history api is used then the hash should be available for other stuff. However, I'm not sure how the browser reacts in this case. I mean you probably have dynamically loaded content that appears later on the page (it is not served by the backend). |
@finppp if you set the second parameter of the Navigo constructor to |
Even with the second parameter as false, I still route to the notFound handler |
I just added a unit test for your case and it passes. Can you please try with the latest version. I remember that I worked on similar issue before so it may be fixed already. |
@krasimir have the same issue const router = new Navigo(null, false);
router
.on('/account',() => {
})
.on('/patches',() => { console.log('patches');})
.resolve(); if I pass url with anchor like |
Also experiencing this issue, using 5.3.1 |
Hey @finppp, @gingray and @bkempner I found out what's causing the problem. I created the following page containing nothing but: const router = new Navigo(null, false);
router
.on('/account',() => {})
.on('/patches',() => {
console.log('patches');
});
router.resolve(); With the following
The page is under my local apache and I could access it via the following URL:
When I open const router = new Navigo('http://home.dev/Krasimir/_tests/navigo/111/', false); I got everything working. So you should provide the root in order to get a proper resolving. P.S. |
There is a new version of Navigo URL:
with the following router configuration: const router = new Navigo("/");
router
.on("/about", () => {
document.querySelector("#content").innerHTML = "about";
})
.on("/links", () => {
document.querySelector("#my-links").innerHTML = "links!!!";
})
.resolve(); and the following html tag on the page: <a id="my-links">my links here</a> leads to the browser scrolling to the tag and also Navigo resolving the route. The example is here: https://github.com/krasimir/navigo/tree/big-rewrite/examples/using-anchor-tags |
Is it possible to use tags with navigo? For example going to:
mysite,co.uk/page1#halfwayDownPage
could load page1 and jump to the div with id="halfwayDownPage"
It currently triggers a link to my notFound handler
Thanks
The text was updated successfully, but these errors were encountered: