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}); }} //页面加载时调用 $(function(){ orient(); }); //用户变化屏幕方向时调用 $(window).bind( 'orientationchange', function(e){ orient();});我这样做为什么每次转屏后都要刷新才能正常显示
添加回答
举报
0/150
提交
取消