Using mousedown event on mobile without jQuery mobile?

You’re looking for touchstart and touchend. They are the events that vmousedown and vmouseup attempt to mimic. Here’s an example: window.onload = function() { //preload mouse down image here via Image() $(“#button_img”).bind(‘touchstart’, function(){ $(“#button_img”).attr(“src”,”button_on.png”); }).bind(‘touchend’, function(){ $(“#button_img”).attr(“src”,”button_off.png”); }); } This will work without any framework on any device that supports touch events. You could use … Read more

Using pre-compiled templates with Handlebars.js (jQuery Mobile environment)

So after much trial and error (which is the best way to learn it) here’s the way that works for me. First- externalize all your templates, say you have a template inside script tags like <script id=”tmpl_ownevents” type=”text/templates”> {{#unless event}} <div class=”notfoundevents”><p>No events for you</p></div> {{/unless}} </script> Create a new file called events.tmpl and copy/paste … Read more

jQuery Mobile Page refresh mechanism

function refreshPage() { jQuery.mobile.changePage(window.location.href, { allowSamePageTransition: true, transition: ‘none’, reloadPage: true }); } Taken from here http://scottwb.com/blog/2012/06/29/reload-the-same-page-without-blinking-on-jquery-mobile/ also tested on jQuery Mobile 1.2.0

jQuery Mobile lock orientation

I have tried to modify manifest.xml and it works. Simply add android:screenOrientation=”landscape” attribute to your activity tag like below: <application android:icon=”@drawable/ic_launcher” android:label=”@string/app_name”> <activity android:label=”@string/app_name” android:name=”.Phonegap_AppName” android:configChanges=”orientation|keyboardHidden” android:screenOrientation=”landscape”> <intent-filter> <action android:name=”android.intent.action.MAIN” /> <category android:name=”android.intent.category.LAUNCHER” /> </intent-filter> </activity> </application>

Pass parameter between pages using jquery mobile

Data/Parameters manipulation between page transitions It is possible to send a parameter/s from one page to another during page transition. It can be done in few ways. Reference: https://stackoverflow.com/a/13932240/1848600 Solution 1: You can pass values with changePage: $.mobile.changePage(‘page2.html’, { dataUrl : “page2.html?paremeter=123”, data : { ‘paremeter’ : ‘123’ }, reloadPage : true, changeHash : true … Read more

jQuery Mobile : What is the order of page events triggering?

Intro All information found here can also be found in my blog ARTICLE, you will also find working examples. – A: Initialization A1 – Phonegap app/framework initialization with the deviceReady event. Example: document.addEventListener(“deviceReady”, yourCallbackFunction, false); function deviceReady() { } More about pause even can be found here: http://docs.phonegap.com/en/1.0.0/phonegap_events_events.md.html A2 – jQuery Mobile app/framework initialization with … Read more