javascript - Noobie Jquery mobile js -


im quite new @ js , jqm. have basic script opens panel when scroll the side. use #panel on of pages script work first page. whats best way make work ever page? have include @ end of every page? should individually name each panel , ("#panel, #panel2") etc.

<script> $( document ).on( "pageinit", document, function() {     $( document ).on( "swipeleft", document, function( e ) {          if ( $.mobile.activepage.jqmdata( "panel" ) !== "open" ) {             if ( e.type === "swipeleft"  ) {                $( "#mypanel" ).panel( "open" );             }         }     }); });     </script> 

you should use $.mobile.activepage.find('#id').panel('open') if using same panel id pages. also, should add panel each page.

demo

$(document).on("swipeleft", '[data-role=page]', function (e) {   if (!$.mobile.activepage.hasclass('ui-page-panel-open') && e.type == "swipeleft") {     $.mobile.activepage.find("#panel").panel("open");   } }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -