Force mobile browser zoom out with Javascript

前端 未结 5 1796
名媛妹妹
名媛妹妹 2020-12-03 17:26

In my web app, I have some thumbnails that open a lightbox when clicked. On mobile, the thumbnails are small and the user typically zooms in. The problem is that when they c

5条回答
  •  难免孤独
    2020-12-03 18:01

    var zoomreset = function() {
        var viewport = document.querySelector("meta[name='viewport']");
        viewport.content = "width=650, maximum-scale=0.635";
        setTimeout(function() {
            viewport.content = "width=650, maximum-scale=1";
        }, 350);
    }
    setTimeout(zoomreset, 150);
    

    replace 650 with the width of your page

提交回复
热议问题