See JQuery function - working fine at first instance only not after URL changes to this (http://localhost/Mobile/Reports/List.html#/Mobile/Reports/Report1.html)
jquery mobile uses hashtag navigation (a timer that checks the hashtag). you should not change the location directly or you will break its code (as you've found). read the jquery mobile docs for how to navigate.
dotnet_CH
Member
40 Points
257 Posts
NavBar href is not working
Jan 04, 2013 08:41 AM|LINK
Hi All,
I have navbar in all the report pages in project. In this project Href is working fine at first instance but not on second due to
URL address
Like :
http://localhost/Mobile/Reports/List.html#/Mobile/Reports/Report1.html
Here two page URLs are join together after using navbar buttons
See Navbar
<!-- navigation bar -->
<div id="navBar" data-role="navbar" class="ui-body-a" data-iconpos="top" data-position="fixed">
<ul>
<li><a href="../Reports/Report1.html" class="ui-btn-active ui-state-persist" id="btnReport1"
data-icon="home">Home</a></li>
<li><a href="../Reports/List.html" data-icon="home" class="respondLIcon" id="btnList">
Respondent List</a></li>
<li><a href="../Reports/Trending.html" data-icon="home" id="btnTrending" class="trendIcon">
Trend</a></li>
<li><a href="#" id="btnMenu" data-icon="gear">Menu</a></li>
</ul>
</div>
<!-- /navbar -->
See JQuery function - working fine at first instance only not after URL changes to this (http://localhost/Mobile/Reports/List.html#/Mobile/Reports/Report1.html)
$("#Report1").click(function () {
var url = "../Reports/Report1.html";
populateData();
$(location).attr('href', url);
});
please help me on this.
thanks
bruce (sqlwo...
All-Star
36822 Points
5441 Posts
Re: NavBar href is not working
Jan 05, 2013 01:46 AM|LINK
jquery mobile uses hashtag navigation (a timer that checks the hashtag). you should not change the location directly or you will break its code (as you've found). read the jquery mobile docs for how to navigate.