javascript - can't get swiping to work for jquery mobile -


Newbie here, sorry if I do not understand all the correct ins and outs of posting ... I have visited something To try and understand the swipe for the perfect jquery mobile mobile, I visited this page for my script - for whatever reasoning reasons, I could not get it to work. I am sure that I Some small and stupid misses ... Is there any Can I see the problem? Thanks

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1, maximum-scale = 1" /> & Lt; Link rel = "stylesheet" href = "_ / css / jquery.mobile.css" /> & Lt; Script src = "_ / javascript / jquery.js" & gt; & Lt; / Script & gt; & Lt; Script src = "_ / javascript / jquery.mobile.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; $ ('Div.ui-page'). Live ("swipeleft", function () {var nextpage = $ (this) .next ('div [data-role = "page"]'); if (nextpage.length & gt; 0) {$ .mobile.changePage (Next page, "slide", wrong, true);}}); $ ('Div.ui-page'). Live ("swiperight", function () {var prevpage = $ (this) .prev ('div- [data-role = "page"]'); if (prevpage.length & gt; 0) {$ .mobile.changePage (Previous Page, {Infection: "Slide", Reverse: Truth}, Truth, Truth);}}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div data-role = "page" id = "editor" & gt; & Lt; Div & gt; Bucker & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div data-role = "page" id = "innovation1" & gt; & Lt; Div & gt; Bunk & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

I made you an example:

  $ (Document) .on ('swipeleft', '[data-role = "page"]', function (event) {if (event.handled! == true) // Once this event is triggered, Var next page = $ (this) .next ('[data-role =' 'page'] '); // Swipe using the next page ID if present (nextpage.length & gt; 0) {$ .mobile.changePage (nextpage, {transit: "slide", reverse: footy}, true, true);} event.handled = true;} return false;}); $ (Document) .on ('swiperight', '[data-role = "page"]', function (event) {if (event.handled! == true) // will prevent this incident from triggering again {Var Prevpage = $ (this) .prev ('[data-role = "page"]'); if (prevpage.length & gt; 0) {$ .mobile.changePage (Previous Page, {Infection: "Slide" , Reverse: true}, true, true);} event.handled = true;} return false;});   

And you are working fine. I've replaced JS and CSS initialization with jQuery 1.8.2 and jQuery Mobile 1.2. Take a look here:

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1, maximum-scale = 1" /> & Lt; Link rel = "stylesheet" href = "http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> & Lt; Script src = "http://www.dragan-gaic.info/js/jquery-1.8.2.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; $ ('Div.ui-page'). Live ("swipeleft", function () {var nextpage = $ (this) .next ('div [data-role = "page"]'); if (nextpage.length & gt; 0) {$ .mobile.changePage (Next page, "slide", wrong, true);}}); $ ('Div.ui-page'). Live ("swiperight", function () {var prevpage = $ (this) .prev ('div- [data-role = "page"]'); if (prevpage.length & gt; 0) {$ .mobile.changePage (Previous Page, {Infection: "Slide", Reverse: Truth}, Truth, Truth);}}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div data-role = "page" id = "editor" & gt; & Lt; Div & gt; Bucker & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div data-role = "page" id = "innovation1" & gt; & Lt; Div & gt; Bunk & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

jsp - Google line chart x-axis shrinks on transition -

java - Reaching JTextField in a DocumentListener -