Guest User

Untitled

a guest
Jan 16th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $(window).bind('orientationchange', function (event) {
  2. if (event.orientation == "landscape") {
  3. set frame for landscape
  4. } else {
  5. set frame for portrait
  6. }
  7. });
  8.  
  9. $(window).bind('orientationchange', function(event) {
  10. alert('new orientation:' + event.orientation);
  11. });
  12.  
  13. $(window).on('load orientationchange', function(event) {
  14. if(event.orientation == "landscape")
  15. {
  16. set frame for landscape
  17. }
  18. else
  19. {
  20. set frame for portrait
  21. }
  22. });
  23.  
  24. var isiPad = navigator.userAgent.indexOf('iPad') != -1
  25.  
  26. //or
  27. var ua = navigator.userAgent;
  28. var isiPad = /iPad/i.test(ua)
  29. if (isiPad) {
  30. $(window).on('load orientationchange', function(event) {
  31. if(window.innerHeight > window.innerWidth){
  32. console.log("portrait");
  33. } else {
  34. console.log("landscape");
  35. }
  36. });
  37. }
Add Comment
Please, Sign In to add comment