移动端页面通过js自动适配

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35746765/article/details/79193417
var  phoneWidth  =  parseInt ( window . screen . width ),
phoneScale  =  phoneWidth / 750 ;
document . write ( '<meta name="viewport" content="width=750, initial-scale=1, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">' );

这是一段以iPhone6 750px为标准的控制JS 只要写一套750px的样式即可;

猜你喜欢

转载自blog.csdn.net/qq_35746765/article/details/79193417