JQM ignores the content of
<head> on all but the first page. Anything you change in
<head> between pages will not have any effect. (Except for
<title>).
I see you are using IDs for left panel and right panel, and duplicating them on each page. This will not work. When you reference an ID, the browser will not know which of multiple duplicate IDs you mean, and will have to punt. (And different browsers punt differently.)
You will need to take a different approach, using classes, rather than IDs.
Since you want to do this on every page, why not just use
.ui-page rather than the page ID, and use classes instead of IDs for left panel and right panel?
- $( document ).on( "pageinit", ".ui-page", function() {
- var $page = $(this);
- $page.on( "swipeleft swiperight", function( e ) {
- if ( $page.jqmData( "panel" ) !== "open" ) {
- if ( e.type === "swipeleft" ) {
- $page.find( ".right-panel" ).panel( "open" );
- } else if ( e.type === "swiperight" ) {
- $page.find( ".left-panel" ).panel( "open" );
- }
- }
- });
- });