In my jQM application, I have a header that I want to keep. Due to a problem with fixed headers in jQM, I decided to create this structure:
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script> </head> <body style="overflow:hidden;"> <div data-role="navbar"> <ul> <li><a href="#page1" class="ui-btn-active">One</a></li> <li><a href="#page2">Two</a></li> </ul> </div> <div id="page1" data-role="page" style="top:80px"> <div data-role="content"> Page1 <input type="button" value="Click"/> </div> </div> <div id="page2" data-role="page" style="top:80px"> <div data-role="content"> Page2 <input type="button" value="Click2"/> </div> </div> </body> </html>
The goal is to keep the navigation bar at the top. When you click the appropriate tab, it should load the page. Since I gave padding-top
for the data-role="page"
div, it will display as if the title were fixed at the top. But it does not work as intended, in the sense that the data-role="navbar"
do not apply to the title in the title.
Any solution to make it work. Thanks in advance.
Demo here - http://jsfiddle.net/UPZrs/
source share