개발일지/2015

[jQuery] Magnific popup conflict with "jquery.nicescroll"

zineeworld 2015. 10. 5. 18:47
반응형

[출처] https://github.com/dimsemenov/Magnific-Popup/issues/183


html에 nicescroll을 적용시킨 상태에서 magnific popup을 켰다가 끄면 아래와 같이 스크롤이 중첩된다.

nicescroll은 선택된 대상을 overflow: hidden이 되도록 자동으로 변경되는데, magnific popup이 close될때 이 속성을 해제해버려서

원래 윈도우 스크롤이 다시 뜨게 된다.



해결 방법은 아래와 같다.



$('yourElement').magnificPopup({ ...your Popup configuration... });

//Add the following to your configuration:

callbacks: {
    afterClose: function() {
    $('html').css('overflow', 'hidden');

}

}


반응형