I have this simple script:
function orientation() {
var orientation = window.orientation;
switch(orientation) {
case 0:
alert('0');
break;
case 90:
alert('90');
break;
case -90:
alert('-90');
break;
}
}
$(document).ready(function(){
window.onorientationchange = orientation();
})
but somehow I never get an alert on my ipad when I turn it… Have I made a mistake somewhere?
Thanks for your help guys :).
Here:
You need to assign the function itself not the result of its execution.