찾다

 >  Q&A  >  본문

jquery - 如何阻止h5body的滑动

做了个选择时间的控件。处于上一层,滑动选择时间的时候,有时候底部也跟着滑动。该怎么解决呢?

怪我咯怪我咯2863일 전487

모든 응답(1)나는 대답할 것이다

  • 高洛峰

    高洛峰2017-04-17 11:49:04

    // 禁止
    document.body.style.overflow = 'hidden';
    function _preventDefault(e) { e.preventDefault(); }
    window.addEventListener('touchmove', _preventDefault);
    
    // 恢复
    document.body.style.overflow = 'auto';
    window.removeEventListener('touchmove', _preventDefault);

    회신하다
    0
  • 취소회신하다