Событие touch не срабатывают если страница прокручивается на Iphone safari
Если страница прокручивается (с ускорением) то touch события не срабатывают на белом прямоугольнике
Демо codepen https://codepen.io/-greg-/full/MWyjJNK
HTML
<section class="scroll"></section>
<div class="fix">
<p class="handle"></p>
</div>
js
const fix = document.querySelector('.fix')
const text = document.querySelector('.handle')
fix.addEventListener('touchstart', handle) //nothing happens while the page is scrolling
fix.addEventListener('touchend', handle) //nothing happens while the page is scrolling
fix.addEventListener('mousedown', handle) //nothing happens while the page is scrolling
fix.addEventListener('touchmove', handle) //nothing happens while the page is scrolling
function handle(e){
text.innerText = e.type
console.log(e)
}
CSS
.scroll{
width: 100%;
height: 2000vh;
background: rgb(226,252,193);
background: linear-gradient(0deg, rgba(226,252,193,1) 0%, rgba(182,251,176,1) 3%, rgba(204,128,151,1) 49%, rgba(134,133,189,1) 75%, rgba(71,153,222,1) 98%, rgba(0,204,247,1) 100%);
}
*{
padding: 0;
margin: 0;
}
.fix{
position: fixed;
display: flex;
align-items: center;
justify-content: center;
bottom: 0;
left: 0;
right: 0;
height: 150px;
background-color: #fff;
}
.handle{
font-size: 20px;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none;
}