@TerryWan
2016-10-18T08:17:33.000000Z
字数 739
阅读 1489
前端
(function(){var supportsOrientation = (typeof window.orientation == 'number' && typeof window.onorientationchange == 'object');var HTMLNode = document.body.parentNode;if(!localStorage.gotolandscape) localStorage.gotolandscape = 0;var init = function() {if(navigator.userAgent.toLowerCase().indexOf('windows')<0){if(window.innerWidth < window.innerHeight){localStorage.gotolandscape = parseInt(localStorage.gotolandscape) + 1;if(localStorage.gotolandscape<2){localStorage.gotolandscape = 1;location.reload();return;};document.body.setAttribute("class", "");//location.reload();}else{localStorage.gotolandscape = 0;document.body.setAttribute("class", "darkmask");}}}window.addEventListener("resize", function(){document.body.setAttribute("class", "");init();}, false);})();