lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.17k stars 1.76k forks source link

disableScrolling doesn't work on mobile #608

Closed Maculotti closed 6 years ago

Maculotti commented 6 years ago

Hello there, I set the option disablescrolling as a true but on a mobile device I can still scroll. Why? this is my code:

// Lightbox
  // --------------------------------------------------
  lightbox.option({
    'resizeDuration': 200,
    'alwaysShowNavOnTouchDevices': true,
    'disableScrolling': true,
    'wrapAround': true,
    'fixedNavigation': true,
    'albumLabel' : '%1 / %2'
  })

I guess it's due to the hight of #lightboxOverlay element and the value applied to #lighbox element.

davemin commented 6 years ago

Same issue on iOS not working.

lokesh commented 6 years ago

Fix incoming in next release. Currently in dev branch. Thanks for reporting. https://github.com/lokesh/lightbox2/pull/611

lokesh commented 6 years ago

Resolved: https://github.com/lokesh/lightbox2/releases/tag/v2.10.0

Maculotti commented 6 years ago

I can't see the image anymore because the image container it's pushed down and the container is fixed. @davemin is it working in your case?

May I suggest that if the options disableScrolling it's true always position the lightbox like this: top: 50% transform: translateY(-50%);

instead of using top: window.scrollTop() so it will be in the center of the fixed container.

Thanks