Home > Backend Development > PHP Tutorial > javascript - How to prevent users from sliding the page on mobile phones

javascript - How to prevent users from sliding the page on mobile phones

WBOY
Release: 2016-08-04 09:19:17
Original
988 people have browsed it

I have a page that needs to prohibit users from sliding up and down when browsing on mobile phones. How to set the corresponding css style or js

Reply content:

I have a page that needs to prohibit users from sliding up and down when browsing on mobile phones. How to set the corresponding css style or js

I just encountered this problem today. I don’t know if css can be disabled, but the js I used can be set up. Please refer to this js and give it a try

<code><script>
document.addEventListener('touchmove', function (e) {
    e.preventDefault()
})
</script></code>
Copy after login

For reference only, hope it helps you

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