Home  >  Article  >  Backend Development  >  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
WBOYOriginal
2016-08-04 09:19:17937browse

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>

For reference only, hope it helps you

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