Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Check for links with a #href_segment at the end and change transition based on it. #5282

Closed
Marnix-IxD opened this issue Nov 14, 2012 · 1 comment

Comments

@Marnix-IxD
Copy link

Issue description:

Whenever someone uses a # tag in their url, it currently breaks jquery mobile. But it is commonly used within other platforms to go to the top of the page or down to a lower segment inside the same page.

I must say I'm no expert in either jQuery or Javascript or anything (I would like to become one though) But the source code by my understanding uses hash tags to define how jquery mobile handles which pages are loaded and where the transitions go.

In the source code of uncompressed source code from the jquery site from line 2801 till 3090 many different segments / url definitions are created with the

parseUrl : function( url ){ }

Even though array segment [17] lists the #hash elements in the URL the rest of jQuery mobile doesn't handle URL's already containing a # correctly in my opinion.

hash # tags are used as anchor links inside a document, so it would only be used when its in the last segment of the link.

Pseudo code example: full-url/sitepaths/page#divname

In my opinion it would be nice that when there is a # tag in the last segment of a Url, it would be used as a final transition to that #div inside the page after the page defined in the url before that # tag has been loaded by jQuery mobile. Especially in mobile applications where website content easily can become really long because of the fitting of it in the mobile device screens.

Test page (see below)
http://www.marnixdesigns.com/dev/hashtagexample/index.html
http://www.marnixdesigns.com/dev/hashtagexample/page2.html

Steps to reproduce
Go to either of the links above and try clicking the links.

Expected outcome
I would expect this to still load the next page. It would be nice if it first made the transition to the page and then goes to the section defined by the #. Or even nicer would be if it goes to the #div before transitioning.

Actual outcome
Broken link, nothing happens, no errors thrown.

Platforms/browsers (including version) and devices tested
Latest non beta versions Firefox & chrome

jQuery Mobile and jQuery core version used
1.2.0 and 1.8.2

@toddparker
Copy link
Contributor

Thanks for the detailed issue report. This is currently a limitation of the nav framework because of the complexity of distinguishing between page level links and onternal anchors but thus is on the roadmap to tackle in an upcoming release. Closing as a duplicate and feature request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants