tuax/tua-body-scroll-lock

The `body-scroll-lock` demo calls the wrong methods

claus opened this issue · 5 comments

claus commented
btn.onclick = function() {
  modalOne.style.display = 'block'
  bodyScrollLock.enableBodyScroll(targetOne)
}
modalBtn.onclick = function() {
  modalTwo.style.display = 'block'
  bodyScrollLock.enableBodyScroll(targetTwo)
}

If you call disableBodyScroll instead of enableBodyScroll, you'll find that the body-scroll-lock demo works just fine with the original package.

Sorry, my fault.
I thought it was enableBodyScrollLock... 😂

https://codepen.io/buptsteve-the-encoder/pen/RwqEqKL
emmm, still some bugs...

1. iOS scroll to top

RPReplay_Final1690899024.mov

2. enableBodyScroll for all

QQ20230801-221359-HD.mp4
claus commented

Regarding the scroll-to-top bug, that's actually not a bug in the code, but a broken ESM build. Try grabbing the code from body-scroll-lock and putting it directly into your app and import from there, and you'll see it magically starts working.

Regarding the scroll-to-top bug, that's actually not a bug in the code, but a broken ESM build. Try grabbing the code from body-scroll-lock and putting it directly into your app and import from there, and you'll see it magically starts working.

I mean when i call enableBodyScroll by modalTwo, the body scroll lock is disabled, which was locked by modalOne.

claus commented

Oh gotcha, my bad!