if (typeof itsmo == 'undefined') { var itsmo = {}; } if (typeof itsmo.util == 'undefined') { itsmo.util = {}; } itsmo.util.rotation = {}; itsmo.util.rotation.heightDevice; itsmo.util.rotation.widthDevice; itsmo.util.rotation.oldWidth; itsmo.util.rotation.oldHeight; itsmo.util.rotation.getDeviceWidth = function () { return document.documentElement.clientWidth; }; itsmo.util.rotation.getDeviceHeight = function () { return document.documentElement.clientHeight; }; var supportsOrientationChange = "orientationchange" in window, orientationEvent = supportsOrientationChange ? "orientationchange" : "resize"; $(window).ready(function () { itsmo.util.rotation.widthDevice = itsmo.util.rotation.getDeviceWidth(); itsmo.util.rotation.heightDevice = itsmo.util.rotation.getDeviceHeight(); }); $(function () { itsmo.util.rotation.widthDevice = itsmo.util.rotation.getDeviceWidth(); itsmo.util.rotation.heightDevice = itsmo.util.rotation.getDeviceHeight(); itsmo.util.rotation.oldWidth = itsmo.util.rotation.widthDevice; itsmo.util.rotation.oldHeight = itsmo.util.rotation.heightDevice; }); itsmo.util.rotation.checkCompleteRotate = function () { if (itsmo.util.rotation.oldWidth != itsmo.util.rotation.widthDevice && itsmo.util.rotation.oldHeight != itsmo.util.rotation.heightDevice) { if (itsmo.util.rotation.detectOrientation() == 1) { if (itsmo.util.rotation.widthDevice > itsmo.util.rotation.oldWidth && itsmo.util.rotation.heightDevice < itsmo.util.rotation.oldHeight) { itsmo.util.rotation.oldWidth = itsmo.util.rotation.widthDevice; itsmo.util.rotation.oldHeight = itsmo.util.rotation.heightDevice; return true; } } else { if (itsmo.util.rotation.widthDevice < itsmo.util.rotation.oldWidth && itsmo.util.rotation.heightDevice > itsmo.util.rotation.oldHeight) { itsmo.util.rotation.oldWidth = itsmo.util.rotation.widthDevice; itsmo.util.rotation.oldHeight = itsmo.util.rotation.heightDevice; return true; } } } else if (itsmo.util.rotation.oldWidth == itsmo.util.rotation.widthDevice && itsmo.util.rotation.oldHeight == itsmo.util.rotation.heightDevice) { return true; } return false; }; itsmo.util.rotation.detectOrientation = function () { if (itsmo.util.rotation.heightDevice < itsmo.util.rotation.widthDevice) { return 1;//1 is landscape } return 0; }