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.
$(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
Post a Comment