In association with heise online

02 September 2009, 08:57

jQuery arrives on the iPhone

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

jQtouch in action
jQtouch in action
Google Code is now home to a version of the free jQuery JavaScript framework that has been specially adapted for the iPhone. Among other things, jQTouch allows applications to access the iPhone's hardware functionality, enabling web applications to process orientation changes as well as multi-touch gestures.

iPhone-specific behaviour can be associated with HTML elements via specific CSS selectors. For example, the default "ul li a" selector has associated behaviour which ensures that a link in a list element responds to a finger swipe towards the left and displays an appropriate sliding transition. Similarly, the ".back, .cancel, .goback" selector causes the elements tagged with the corresponding CSS classes to behave like Apple's "back" button. Developers can freely choose or override most of these selectors when initialising jQTouch.

jQTouch provides suitable events for both, and developers can add the usual callbacks for processing. A handler which responds to the device being rotated, for example, could look like this.

$(function(){
$('body').bind('turn', function(event, info){
console.log(info.orientation); // landscape or portrait
});

jQTouch's home page also has a video demo of the functionality in operation. The framework aims to support not just the iPhone, but also Android and Palm Pre phones as well as "other forward-thinking devices".

Other iPhone web application frameworks:

(djwm)

Print Version | Send by email | Permalink: http://h-online.com/-743209
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit