0

jQuery(document).ready(function($) {
 //capture ipad device change
function doOnOrientationChange()
{
    switch(window.orientation)
    {
      case -90: 
      case 90:
        alert('landscape'); //debug
        ////add class to assist with libraries like Modernizr
        $('html').removeClass('portrait').addClass('landscape'); 
        break;
      default:
        alert('portrait'); //debug
        $('html').removeClass('landscape').addClass('portrait');
        break;
    }
}
 //setup event listener
window.addEventListener('orientationchange', doOnOrientationChange);
 //initial call
doOnOrientationChange(); 
});

Jagdish Sarma Asked question August 8, 2022
Add a Comment