lokesh / lightbox2

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

Provide a more flexible vertical positioning #529

Open teo1978 opened 8 years ago

teo1978 commented 8 years ago

It appears that the only parameter to adjust the vertical position of the box is:

positionFromTop The distance from top of viewport that the Lightbox container will appear, in pixels.

This is a very poor positioning scheme. I understand its simplicity of implementation but it is too limited. There should at the very least be

There might be richer and more elaborate models (or perhaps simpler but more powerful ones), these are just out of the top of my head.

When the screen is much bigger than the image, a small value of positionFromTop is ugly. On the other hand, on small screens (e.g. mobile devices) a large value wastes a lot of space and keeps the image unnecessarily small. So, a fixed top value is clearly an insufficient scheme.

richrd commented 7 years ago

I was just looking for a solution for this. I tried centering by setting display:flex on #lightbox but that won't work since the container has two children which are supposed to be on top of each other. If the container had one extra wrapper this could be easily achieved.

kess42 commented 7 years ago

On a mobile touch device (iPhone 6, IOS 10.2.1, in the Safari browser): On a long page with many images further down below, viewing an image requires to scroll all the way up to the top of the page to view this image(s) because it is not shown relative to the actual position on the page but at the absolute top (on the iPhone). Do I miss a parameter or is there a way out? Thanks for the great script and your help, BR, kess42

andreich1980 commented 6 years ago

Same story as @kess42 have experienced. On small screens when click link to view a picture it scrolls the page to the top

UPD It only happens when disableScrolling=true

lokesh commented 5 years ago

Fix for the mobile issue that caused the scroll to the top behavior will be out shortly and is in the dev branch. PR: https://github.com/lokesh/lightbox2/pull/650

^ Does not address the original request from this issue. Lightbox2 is in maintenance mode so the added flexibility for vertical positioning is not planned but is something I will consider for a potential v3.