简体   繁体   中英

Disable ONLY horizontal scroll on iPad

I want to block scrolling from left to right (horizontal) on a website viewed on a iPad/iPhone. But scroll from top to bottom (vertical) has to be enabled.

No result with CSS:

overflow-x: hidden;

You can still scroll on the iPad.

Javascript document.ontouchmove = function(e){ e.preventDefault(); } document.ontouchmove = function(e){ e.preventDefault(); } blocks all scrolling: horizontal and vertical.

I need a solution to block or disable ONLY the horizontal scrolling. Is that possible?

I think u can use:

overflow: hidden;
overflow-y: auto;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM