mobile: prevent overscroll and pull-to-refresh (#235)
This commit is contained in:
parent
c17e5cdc30
commit
d25b875038
3 changed files with 21 additions and 0 deletions
|
|
@ -2,3 +2,4 @@ require('./zoom')
|
|||
require('./lobby').create()
|
||||
require('./sidepanel')
|
||||
require('../events/click')
|
||||
require('../ios')
|
||||
|
|
|
|||
19
src/browser/js/app/ui/ios.js
Normal file
19
src/browser/js/app/ui/ios.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Prevent iOS Pull-To-Refresh
|
||||
|
||||
if (!!navigator.platform.match(/iPhone|iPod|iPad/)) {
|
||||
|
||||
var preventNextMove = false
|
||||
|
||||
document.addEventListener('touchstart', (e)=>{
|
||||
if (e.touches.length === 1) preventNextMove = (window.pageYOffset === 0)
|
||||
}, false)
|
||||
|
||||
document.addEventListener('touchmove', (e)=>{
|
||||
// preventDefault the first overscrolling touchmove
|
||||
if (preventNextMove) {
|
||||
preventNextMove = false
|
||||
e.preventDefault()
|
||||
}
|
||||
}, false)
|
||||
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ html, body {
|
|||
height:100%;
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
html{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue