0
我試圖使用iOS的Web應用程序:輸入忽略觸摸事件
$('body').on('touchmove',function(e){e.preventDefault()});
在Safari中一切禁用頁面滾動工作正常,但在全屏模式下僅input
和textarea
不妨礙滾動和忽略任何觸摸事件。我認爲它開始於iOS8。
這裏的例子:
<!doctype html>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name=viewport content='width=device-width'>
<body ontouchmove="event.preventDefault()">
<div>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
</div>
<input value='Input'><br>
<textarea>Textarea</textarea><br>
<div contentEditable=true>Editable div</div><br>
<button onclick='location.reload()'>Reload</button>
我這麼想嗎?
是否可以防止觸摸<input>
滾動?