Shenglian / -WORK_TIP

工作上小技巧
4 stars 1 forks source link

[js] Can't prevent `touchmove` from scrolling window on iOS #135

Open Shenglian opened 6 years ago

Shenglian commented 6 years ago

Improving_scrolling_performance_with_passive_listeners

document.addEventListener('touchmove', function(e) {
    e.preventDefault();
}, { passive: false });

原因: This is because document touch event listeners are now passive by default in Safari 11.1, which is bundled with iOS 11.3. This change is documented in the Safari 11.1