I've started a jQuery iPhone plugin project to extend jQuery
functionality for specific iPhone features.
Project Page:
http://plugins.jquery.com/project/iphone
Direct Download:
http://jquery.thewikies.com/iphone/jquery.iphone.zip
So far it's not much, but what it does do you may find very useful,
and for jQuery users it should be fairly simple, because this script
tries to always keep with the jQuery lexicon. Here is an example of
jQuery.
$(document).ready(
function(){
$('body').html('<p>The entire site body was replaced with this text
before you even saw it!</p>');
}
);
One thing my script will do is hide the URL bar, regardless of the
height of your page or if you have a stylesheet present. It just
works.
$(document).ready(
function(){
$.iPhone.hideURLbar(); // This will hide the URL bar when the page
first appears.
}
);
Also, you can disable and reenable the automatic text size adjustments
when rotating your iphone to different angles.
$(document).ready(
function(){
$.iPhone.disableTextSizeAdjust(); // No text resizing right from the
get-go.
}
);
Finally, (and I'm working on more functions, so I'm sorry there are so
few so far), you can automatically detect and launch functions based
on whenever the iPhone makes a rotation change / orientation change /
tilt change / whatever-you-want-to-call-it.
$(document).iPhone.orientchange(
function(){
alert('the iphone has rotated the screen');
}
);
Following the jQuery standard of extensibility, you can write custom
functions for portrait and landscape, separately.
$(document).iPhone.orientchange(
function(){
alert('the iphone has rotated the screen to portrait');
},
function(){
alert('the iphone has rotated the screen to landscape');
}
);
Or you can also write custom functions for portrait, 90 degree
landscape, and -90 degree landscape.
$(document).iPhone.orientchange(
function() {
alert('the iphone has rotated the screen to portrait');
},
function() {
alert('the iphone has rotated the screen to a 90 degree landscape');
},
function() {
alert('the iphone has rotated the screen to a -90 degree
landscape');
}
);
That's all for now. Any feedback is gold to me. :)