프로그래밍/JavaScript & jQuery
[jQuery] 스크롤 막는 방법
fbt
2018. 1. 2. 04:46
$(스크롤을 막아야하는 영역).on('scroll touchmove mousewheel', function(e){
e.preventDefault();
e.stopPropagation();
return false;
})
해제를 하는 방법은 제이쿼리의 off를 이용해서
$(스크롤을 막아야하는 영역).off('scroll touchmove mousewheel');
로 해제하거나,
모달 팝업같은 상황에선 영역을 모달팝업으로 잡아, 팝업이 닫히면 이벤트가 해제되게하면된다