Created
October 4, 2013 13:00
-
-
Save versluis/6825532 to your computer and use it in GitHub Desktop.
How to (re-) enable the Default Back Button in jQuery Mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>jQuery Mobile Web App</title> | |
<!-- link jQuery Mobile styles --> | |
<link href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css"/> | |
<!-- load jQuery --> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script> | |
<!-- make sure the BACK button is enabled by default --> | |
<script> | |
// adding a back button | |
$(document).bind("mobileinit",function() {$.mobile.page.prototype.options.addBackBtn = true; }); | |
</script> | |
<!-- load jQuery Mobile --> | |
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div data-role="page" id="page"> | |
<div data-role="header"> | |
<h1>Page One</h1> | |
</div> | |
<div data-role="content"> | |
<ul data-role="listview"> | |
<li><a href="#page2">Page Two</a></li> | |
<li><a href="#page3">Page Three</a></li> | |
<li><a href="#page4">Page Four</a></li> | |
</ul> | |
</div> | |
<div data-role="footer"> | |
<h4>Page Footer</h4> | |
</div> | |
</div> | |
<div data-role="page" id="page2"> | |
<div data-role="header"> | |
<h1>Page Two</h1> | |
</div> | |
<div data-role="content"> | |
Content | |
</div> | |
<div data-role="footer"> | |
<h4>Page Footer</h4> | |
</div> | |
</div> | |
<div data-role="page" id="page3"> | |
<div data-role="header"> | |
<h1>Page Three</h1> | |
</div> | |
<div data-role="content"> | |
Content | |
</div> | |
<div data-role="footer"> | |
<h4>Page Footer</h4> | |
</div> | |
</div> | |
<div data-role="page" id="page4"> | |
<div data-role="header"> | |
<h1>Page Four</h1> | |
</div> | |
<div data-role="content"> | |
Content | |
</div> | |
<div data-role="footer"> | |
<h4>Page Footer</h4> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
as discussed here: http://pinkstone.co.uk/android/how-to-add-a-back-button-in-jquery-mobile/