1

I am creating my first project with Jquery mobile. I have two pages Page_A.html and Page_B.html.

My code is the following in Page_A.html:

<a href="Page_B.html#anchor1">Link1</a>

and in Page_B.html:

<div id="anchor1">Some content here</div>

When I click Link1 in Page_A the link takes me to Page_B and momentarily shows the correct content of the div with the id "anchor1". However after a second or so something happens and it looks like the page reloads itself and the viewer sees the top of the page. What am I doing wrong?

Omar
  • 32,302
  • 9
  • 69
  • 112
user1201723
  • 115
  • 2
  • 8
  • add `data-ajax='false'` to link1. – Omar Jun 05 '13 at 13:38
  • I have tried adding data-ajax='false' but the problem remains. I have also tried this solution http://dev4theweb.blogspot.it/2012/07/anchor-links-and-jquery-mobile.html but it does not help either. – user1201723 Jun 05 '13 at 13:54
  • also try adding `data-rel='external'`. – Omar Jun 05 '13 at 13:54
  • data-rel='external' is also not working – user1201723 Jun 05 '13 at 13:57
  • added them together and still not working? the link explains anchors within one page not separate html files. – Omar Jun 05 '13 at 13:59
  • Yes added them together but no change. Basically what happens is that in the beginning it works but then the page refreshes and scrolls to the top. I think I have the same problem with this: http://stackoverflow.com/questions/12389126/how-to-disable-jquery-mobile-scrolling-to-top-of-the-page – user1201723 Jun 05 '13 at 14:04
  • I guess - not sure though - the only solution is to disable Ajax Navigation completely, which I assume you don't want to do. – Omar Jun 05 '13 at 14:06
  • No probably not since the page contains other links that work OK with ajax navigation – user1201723 Jun 05 '13 at 14:11
  • try this solution http://stackoverflow.com/questions/12181586/jquery-mobile-tabs-and-anchors/12182868#12182868 – Omar Jun 05 '13 at 14:34

0 Answers0