Home > Article > Backend Development > javascript - How to prevent users from sliding the page on mobile phones
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 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