HTML5自动横屏的方法
<事前>
ウィンドウ内のvar EVT = "onorientationchange"?「orientationchange」:「リサイズ」。
window.addEventListener(EVT、関数(){
にconsole.log(EVT);
VAR幅= document.documentElement.clientWidth;
VAR高さ= document.documentElement.clientHeight;
$印刷= $( '#印刷');
IF(幅>高さ){
$ print.width(幅);
$のprint.height(高さ);
$ print.css( '上部'、0);
$ print.css( '左'、0);
$ print.css( '変換' 'なし');
$のprint.css('変換原点、'50%50% ');
}
他{
$ print.width(高さ);
$ print.height(幅)
の$ print.css( '上'、(高さ幅)/ 2)。
$ print.css(0-、 '左'(高さ幅)/ 2)。
$ print.css( '変換'、 '回転(90deg)');
$ print.css( '変換-起源'、'50%50% ');
}
</ PRE>
自動横画面の方法HTML5
おすすめ
転載: www.cnblogs.com/newmiracle/p/11853044.html
ランキング