Home > Web Front-end > H5 Tutorial > How to prevent mobile device (mobile phone, pad) browser from double-clicking to enlarge a web page_html5 tutorial skills

How to prevent mobile device (mobile phone, pad) browser from double-clicking to enlarge a web page_html5 tutorial skills

WBOY
Release: 2016-05-16 15:47:48
Original
2897 people have browsed it

Nowadays, browsers on mobile devices such as mobile phones or tablets have a double-click to enlarge setting by default. How can I prevent double-clicking to zoom in?

The viewport meta is provided on the Mobile page, which can be used to set zoom. But before using viewport, you need to change the document type of the page to Mobile type. The usual page DTD is XHTML or simple HTML5 declaration. Mobile devices should use the following declaration.

Copy code
The code is as follows:

After setting the DTD, you can use the viewport to disable zooming of the page. It is common to set user-scalable to 0 to turn off user scaling of the page view.

Copy code
The code is as follows:

But for better compatibility, we will use the complete viewport setting.


Copy code
The code is as follows:

If you need more detailed information about viewport, please refer to MDN

https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag

It seems that the DTD can only be declared as HTML5, and the viewport tag is added below

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template