
- jQuery Mobile Tutorial
- jQuery Mobile - Home
- jQuery Mobile - Overview
- jQuery Mobile - Setup
- jQuery Mobile - Pages
- jQuery Mobile - Icons
- jQuery Mobile - Transitions
- jQuery Mobile - Layouts
- jQuery Mobile - Widgets
- jQuery Mobile - Events
- jQuery Mobile - Forms
- jQuery Mobile - Themes
- jQuery Mobile - CSS Classes
- jQuery Mobile - Data Attributes
- jQuery Mobile Useful Resources
- jQuery Mobile - Interview Questions
- jQuery Mobile - Quick Guide
- jQuery Mobile - Useful Resources
- jQuery Mobile - Discussion
jQuery Mobile - Internal and External Panels
Description
You can display the internal and external panels by giving the panels path in the href attribute.
Example
Following example describes the use of internal and external panels in the jQuery Mobile framework.
<!DOCTYPE html> <html> <head> <title>External and Internal Panels</title> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> <script> $( document ).on( "pagecreate", function() { $( "body > [data-role = 'panel']" ).panel(); $( "body > [data-role = 'panel'] [data-role = 'listview']" ).listview(); }); $( document ).one( "pageshow", function() { $( "body > [data-role = 'header']" ).toolbar(); $( "body > [data-role = 'header'] [data-role = 'navbar']" ).navbar(); }); </script> </head> <body> <div data-role = "header" data-position = "fixed" data-theme = "a"> <h2>Header</h2> </div> <div data-role = "page"> <div role = "main" class = "ui-content"> <h2>This is first page.</h2> <a href = "#page_one" class = "ui-btn ui-btn-inline">Click here to open right panel</a> </div> <div data-role = "panel" id = "page_one" data-position = "right" data-display = "overlay" data-theme = "b"> <ul data-role = "listview"> <li data-icon = "delete"><a href = "#" data-rel = "close">Close</a></li> <li>New Zealand</li> <li>England</li> <li>South Africa</li> </ul> </div> <div data-role = "footer" data-position = "fixed"> <div data-role = "navbar"> <ul> <li><a href = "/jquery_mobile/src/jqm_external_internal_panel.html" class = "ui-btn-active">Page One</a></li> <li><a href = "/jquery_mobile/src/page2.html">Page Two</a></li> </ul> </div> </div> </div> </body> </html>
Output
Let's carry out the following steps to see how the above code works −
Save the above html code as jqm_external_internal_panel.html file in your server root folder.
Open this HTML file as http://localhost/jqm_external_internal_panel.html and the following output will be displayed.
jquery_mobile_widgets.htm
Advertisements