26 //// That means JavaScript in the head of any other HTML |
26 //// That means JavaScript in the head of any other HTML |
27 //// will be ignored, only the data-role="page" is parsed |
27 //// will be ignored, only the data-role="page" is parsed |
28 //$(document).ready(function() { |
28 //$(document).ready(function() { |
29 //$.mobile.ajaxLinksEnabled = false; |
29 //$.mobile.ajaxLinksEnabled = false; |
30 //}); |
30 //}); |
31 //$(document).on("mobileinit", function() { |
31 $(document).on("mobileinit", function() { |
32 // $.extend( $.mobile , { |
32 $.extend( $.mobile , { |
33 // pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.' |
33 pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.' |
34 // }); |
34 }); |
35 //}); |
35 //$("#pageid").on("pagebeforeshow", function(event, data) { |
36 $(document).on("pageinit", function(event) { |
36 // alert("the previous page was: " + data.prevPage.attr("id")); |
|
37 //}); |
|
38 }); |
|
39 $(document).on("pageinit", function() { |
37 $(".ui-collapsible[data-allow-collapse=false]").off("expand collapse"); |
40 $(".ui-collapsible[data-allow-collapse=false]").off("expand collapse"); |
38 }); |
41 }); |
39 // ]]> |
42 $(document).on("pageinit", "[data-role='page'].oc-swipage", function() { |
|
43 var makepage = "#" + $(this).attr("id"), |
|
44 next = $(this).jqmData("next"), // Next page stored in data-next |
|
45 prev = $(this).jqmData("prev"); // Previous page stored in data-prev |
|
46 |
|
47 if (next) { // Check if data-next attribute is indeed set |
|
48 //// Prefetch next page |
|
49 //$.mobile.loadPage(next); |
|
50 // Navigate to next page on swipe left |
|
51 $(document).on("swipeleft", makepage, function(inev) { |
|
52 inev.stopImmediatePropagation(); |
|
53 $.mobile.changePage(next, {transition: "slide"}); |
|
54 }); |
|
55 } |
|
56 else { // If data-next not set then default to history |
|
57 $(document).on("swipeleft", makepage, function(inev) { |
|
58 inev.stopImmediatePropagation(); |
|
59 window.history.forward({transition: "slide"}); |
|
60 }); |
|
61 } |
|
62 if (prev) { // Check if data-prev attribute is set |
|
63 $(document).on("swiperight", makepage, function(inev) { |
|
64 inev.stopImmediatePropagation(); |
|
65 $.mobile.changePage(prev, {transition: "slide", reverse: true}); |
|
66 }); |
|
67 } |
|
68 else { // If data-prev not set then default to history |
|
69 $(document).on("swiperight", makepage, function(inev) { |
|
70 inev.stopImmediatePropagation(); |
|
71 //history.back(); // or window.history.back(); |
|
72 $.mobile.back({transition: "slide", reverse: true}); |
|
73 }); |
|
74 } |
|
75 }); |