Wednesday, February 22, 2012

fiddling with iPad

jQuery(document).ready(function() {

/*iPad orientation events*/

detectOrientation();
window.onorientationchange = detectOrientation;

function detectOrientation(){

if(typeof window.onorientationchange != 'undefined'){
if(orientation === 90){
// landscape mode
}//end if

else if (orientation === -90){
//Other landscape mode
});

}//end else if

else{
//Portrait mode
}//end else

}
}

iPad touch events:


jQuery("#element").bind("touchstart",function(){
e.preventDefault();
});


jQuery("#element").bind("touchend",function(){
e.preventDefault();
/*Other code here*/
});

jQuery(document).bind("touchstart",function(){
e.preventDefault();
/*Other code here*/
});



});

No comments: