Dandi of FrontEndContento
1/31/2018 - 9:02 AM

Detect viewport orientation

Create a listener to handle device orientation

var handleDeviceOrientation = function(){
  window.addEventListener("orientationchange", function() {
    // angle = 0° = portrait
  	if(screen.orientation.angle == 0){}
  	// angle = 90° = landscape
  	else{}
  }, false);
};