Viewport 结合 JavaScript 实现缩放自适应

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<script>
    var viewport = document.querySelector("meta[name=viewport]");
    var winWidths=jQuery(window).width();
    var densityDpi=360/winWidths;
    densityDpi= densityDpi>1?300*360*densityDpi/360:densityDpi;
    viewport.setAttribute('content', 'width=360, user-scalable=no, target-densityDpi='+densityDpi);
</script>

 102 total views,  4 views today

Revisions

Comments are closed.