簡體   English   中英

如何防止使用 javascript 放大移動設備?

[英]How prevent zoom in mobile using javascript?

要防止放大 html,您可以在標題中使用<meta name="viewport" content="user-scalable=0"/>

如何使用javascript實現防止縮放?

以同樣的方式。

本國的:

var tag = document.createElement('meta');
tag.name="viewport";
tag.content = "user-scalable=0";
document.head.appendChild(tag);

jQuery:

$('<meta name="viewport" content="user-scalable=0"/>').appendTo('head');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM