Thursday, 8 August 2013

Noobie Jquery moblie js

Noobie Jquery moblie js

im quite new at js and jqm. So I have a basic script that opens a panel
when I scroll the the side. I use #panel on all of the pages however the
script will only work for the first page. Whats the best way to make this
work for ever page? Do I have to include it at the end of every page?
Should I individually name each panel and do ("#panel, #panel2") etc.
Thanks <3
<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>

No comments:

Post a Comment