Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect iPad orientation change

How to detect with javascript or jquery when user turns iPad from vertical position to horizontal or from horizontal to vertical?

like image 644
lolalola Avatar asked Jun 06 '11 09:06

lolalola


People also ask

How to detect orientation change in iOS?

You can do that with cmd+k when you have your code selected.

How do I keep the iPad screen from rotating?

If you have an iPhone or iPad with Face ID, swipe down from the top-left corner of the screen. If your iPhone or iPad has a Home button, swipe up from the bottom of the screen. Tap the Rotation Lock button to activate the lock. When active, the Screen Rotation lock icon will be red on a white background.


1 Answers

Try

$(window).bind('orientationchange', function(event) {   alert('new orientation:' + event.orientation); }); 
like image 131
Karl-Bjørnar Øie Avatar answered Oct 10 '22 11:10

Karl-Bjørnar Øie