[关闭]
@TerryWan 2016-10-18T16:17:33.000000Z 字数 739 阅读 1229

转屏

前端


  1. (function(){
  2. var supportsOrientation = (typeof window.orientation == 'number' && typeof window.onorientationchange == 'object');
  3. var HTMLNode = document.body.parentNode;
  4. if(!localStorage.gotolandscape) localStorage.gotolandscape = 0;
  5. var init = function() {
  6. if(navigator.userAgent.toLowerCase().indexOf('windows')<0){
  7. if(window.innerWidth < window.innerHeight){
  8. localStorage.gotolandscape = parseInt(localStorage.gotolandscape) + 1;
  9. if(localStorage.gotolandscape<2){
  10. localStorage.gotolandscape = 1;
  11. location.reload();
  12. return;
  13. };
  14. document.body.setAttribute("class", "");
  15. //location.reload();
  16. }else{
  17. localStorage.gotolandscape = 0;
  18. document.body.setAttribute("class", "darkmask");
  19. }
  20. }
  21. }
  22. window.addEventListener("resize", function(){
  23. document.body.setAttribute("class", "");
  24. init();
  25. }, false);
  26. })();
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注