jqeury mobile pagecontainer change not working on swipe
I am working with jqm 1.4.5.
I want pages to change when user to swipes left and right.
So I created this code:
- $(document ).on( "pageinit", ".my-page", function() {
- $( document ).on( "swipeleft swiperight", ".my-page", function( e ) {
- var prevLink = <some url>;
- var nextLink = <some url>;
- if ( e.type === "swipeleft" ) {
- $( ":mobile-pagecontainer" ).pagecontainer( "change", nextLink, { reloadPage: true});
- } else if ( e.type === "swiperight" ) {
- $( ":mobile-pagecontainer" ).pagecontainer( "change", prevLink, { reloadPage: true});
- }
- }
- }
I get this error on the console log:
- Uncaught TypeError: Cannot read property '0' of undefined
On line with this code:
- $( ":mobile-pagecontainer" ).pagecontainer( "change", nextLink, { reloadPage: true});