When you use a nested listview
, the jQuery Mobile framework generates a sub page in the form of pagename.html&ui-page=subpageidentifier
. The hash segment before the sub page URL key (&ui-page)
is used by the framework for navigation. This recipe shows you how to use a custom sub page URL key. It also shows you how to use the $.mobile.hashListeningEnabled
configuration.
Copy the full code of this recipe from the sources folder code/07/sub-page
. You can launch this code using the URL: http://localhost:8080/07/sub-page/main.html
.
In
main.html
, add the following script before includingjquery.mobile.js
:$(document).bind("mobileinit", function() { $.mobile.subPageUrlKey = "my-page"; $.mobile.hashListeningEnabled = false; });
Create the
#main
page with a nested list in its content as follows:<div data-role="content"> <ul data-role="listview" data-theme="e"> <li>Main Page Item 1...