Home  >  Article  >  Web Front-end  >  How to use H5 to add a zoom-disable function

How to use H5 to add a zoom-disable function

php中世界最好的语言
php中世界最好的语言Original
2018-01-29 09:57:524286browse

This time I will show you how to use H5 to add a zoom-disable function, and what are the precautions for using H5 to add a zoom-disable function. The following is a practical case, let's take a look.

The following piece of code introduces to you

html5Add the function of prohibiting scaling. The specific code is as follows:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />

ps: Prohibit Html5 from scaling the screen page on mobile phones

I recently tested HTML5 pages and found that by default, users are allowed to zoom in and out of the page, or double-click on the screen to zoom in or out. That is equivalent to setting it like this

<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=yes" />

If you want to prohibit this situation, just modify the corresponding parameters

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />

I believe you have mastered the method after reading these cases. For more exciting things, please pay attention to other php Chinese websites related articles!

Related reading:

How to use H5’s FileReader distribution to read files and an introduction to its methods

How to add HTML Element settings

#How to use the title attribute of html to display text on mouse hover

The above is the detailed content of How to use H5 to add a zoom-disable function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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