-
Book Overview & Buying
-
Table Of Contents
jQuery Mobile Cookbook
By :
When you click on a link, navigation happens and the URL hash is updated. The framework allows you to replace the URL
hash to a full path in browsers that support the history.replaceState API. This recipe shows you how to do this using the $.mobile.pushStateEnabled configuration. It also shows you how to use the $.mobile.linkBindingEnabled configuration that allows the framework to automatically bind the clicks on the anchor links in a document. Both these are true by default.
Copy the full code of this recipe from the sources code/07/push-state folder. You can launch this code using the URL: http://localhost:8080/07/push-state/main.html.
In main.html, add the following script before including jquery.mobile.js:
$(document).bind("mobileinit", function() {
$.mobile.linkBindingEnabled = true;
$.mobile.pushStateEnabled = false;
});Create the #main page with the following content:
<div data-role="content">...
Change the font size
Change margin width
Change background colour