function orient() { var supportOrientation = (typeof window.orientation === 'number' &&? ? ? ? ? ? typeof window.onorientationchange === 'object'); var orientation; if(supportOrientation){? ? ? ? orientation = window.orientation;? ? ? ? switch(orientation){? ? ? ? ? ? case 90:? ? ? ? ? ? case -90:? ? ? ? ? ? ? ? orientation ='landscape';? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? break;?? ? ? ? ? ? default:? ? ? ? ? ? ? ? orientation ='portrait';? ? ? ? ? ? ? ? break;? ? ? ? }? ? }else{? ? ? ? orientation = (window.innerWidth > window.innerHeight) ? 'landscape' : 'portrait';? ? }? ? if(orientation == 'landscape'){? ? $(".WScalet").css({"zoom":window.innerWidth/1136});? ? ? ??? ? }? ? if(orientation == 'portrait'){? ? ? ? $(".WScale").css({"zoom":window.innerWidth/640}); ?? ? ? ?? ? }} //頁面加載時(shí)調(diào)用 $(function(){ orient(); }); //用戶變化屏幕方向時(shí)調(diào)用 $(window).bind( 'orientationchange', function(e){ orient();});我這樣做為什么每次轉(zhuǎn)屏后都要刷新才能正常顯示
手機(jī)橫屏問題
lyhzwf
2015-10-23 11:50:59
