Wednesday, August 14, 2013

TouchPunch - drag and drop on mobile devices

I'm starting a project that is going to require drag and drop functionality on mobile devices.  I quickly learned that jQuery UI's wonderful .draggable() method only works with mouse events, making it useless on a tablet or phone.
As always I am not the first to have this problem, so some developers came up with TouchPunch, a small library that forwards mouse events to their touch counterparts. Simply including this library solved the problem without the need to write a single line of code. Booya.
http://touchpunch.furf.com/

Friday, June 28, 2013

Thursday, June 6, 2013

'Flick' scrolling on iPad & iPhone

'Flick scrolling', or kinetic scrolling, is when the user can scroll a menu with momentum.

While developing a user interface at work I discovered that 'flick scrolling' is not enabled by default in the mobile Safari browser.

Long story short, this webkit snippet will solve your problem:
-webkit-overflow-scrolling: touch;

Just put it in a css class and add it to anything that should have 'flick scrolling'.

Thursday, May 23, 2013

JSONP XMLHttp Requests








// define a 'success' callback to handle the results of the request
success = function () {
   // this is called on success
}

// add the callback function 'success' as the query parameter 'callback'
var url = "http://www.api.com/endpoint?callback=success";


// create a new SCRIPT tag, assign the url to the 'src' attribute and append to the HEAD tag
var s = document.createElement("script");
s.src = url;
document.getElementsByTagName("head")[0].appendChild(s);

// couldn't be easier