web页面放到手机页面,缩放问题

有时候写页面样式不规范,很多页面元素写死尺寸时,web页面尺寸比较大放到移动端访问时,就背缩放了,div或者按钮变得好小

可以加段js,效果会好点

 <script>
! function( userAgent ) {
var screen_w = parseInt(window.screen.width),
scale = screen_w / 640;
if ( /Android (\d+\.\d+)/.test( userAgent ) ) {
var version = parseFloat( RegExp.$1 );
document.write( version > 2.3
? '<meta name="viewport" content="width=640, minimum-scale = ' + scale + ", maximum-scale = " + scale + ', target-densitydpi=device-dpi">'
: '<meta name="viewport" content="width=640, target-densitydpi=device-dpi">' );
} else {
document.write( '<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">' );
}
}( navigator.userAgent ); </script>
上一篇:Springboot集成Netty


下一篇:pyenv安装与使用-多版本python共存解决方法