首页 > 移动平台 > 详细

移动端横屏

时间:2016-01-20 18:54:12      阅读:140      评论:0      收藏:0      [点我收藏+]
<style>

@media all and (orientation : landscape) {
/*横屏*/
.topbar,.caption,.profile,.recommend,.plovr-error-report {
display: none !important;
}
}
</style>


<script>
function orientationChange() {
if (typeof window.orientation != ‘undefined‘) {
if (window.orientation == 180 || window.orientation == 0) {
eleMedia.style[‘height‘] = ‘181px‘;
eleBody.scrollTop = 0;
}
if (window.orientation == 90 || window.orientation == -90) {
setTimeout(function () {
var height = Math.max(window.screen.height, window.screen.width) * 9 / 16;
eleMedia.style[‘height‘] = height + ‘px‘;
eleBody.scrollTop = (window.innerHeight - height) / 2;
}, 1);
}
}
}

window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function () {
orientationChange();
}, false);


orientationChange();
</script>

移动端横屏

原文:http://www.cnblogs.com/djdliu/p/5145972.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!