Display Alert Box $(document).live("swipeleft", function () { alert("swipe"); });
All posts by
Swiping
Detecting Swipe Of Page $(document).live("swipeleft", function () { alert("swipe"); }); Detecting swipe over an element $('div.ui-page').on("swipeleft", function () { alert("swipe"); });
Troubleshooting Javascript
Basic Things To Check Search on src=" for included libraries, e.g.: <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> Make sure you haven't included multiple versions of the same library or the same library multiple times.
.Variables General
Declaring Variables
Page Events
Page Creation Events Each page has its own creation or initialization events pagebeforecreate After the page is inserted in the DOM and before its widgets are created. pagecreate After the page is created but before widgets are rendered. pageinit After the page is fully loaded. Normally the most used event for a page. pageremove […]
Toolbars
Use $.mobile.fixedToolbars.show() and $.mobile.fixedToolbars.hide() to show and hide the fixed toolbars. The toolbars can be full screen or just fixed. You can’t hide real fixed toolbars for iOS5 and above. By default, they are shown and hidden using a fade transition. //show the toolbars immediately without fade animation $.mobile.fixedToolbars.show(true);
Loading message pop up
Use $.mobile.showPageLoadingMsg() and $.mobile.hidePageLoadingMsg() to show and hide the loading message pop up from code //Show the loading message then hide it after 3 seconds $.mobile.showPageLoadingMsg(); setTimeout(function() { $.mobile.hidePageLoadingMsg(); }, 3000);
Scrolling
Use $.mobile.silentScroll(y) to scroll to any position in the page without animation and event triggering.
Platform Utilities
orientationChangeEnabled Is the native orientationchange event available? gradeA() true if the browser is an A-grade browser in jQuery Mobile's compatibility chart. urlHistory Collection of pages that were browsed inside jQuery Mobile without a page reload. Every element has pageUrl, title, and transition. getDocumentUrl() Returns the original document's URL (the first load). getDocumentBase() Returns the […]
Load Page Prior To Showing It
Use the $.mobile.loadPage method to bring a target page to the DOM but to not transition to it, i.e. if you want to prefetch content. Then use changePage in the future to transition to it with the jQuery DOM object.