Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a more flexible vertical positioning #529

Open
teo1978 opened this issue Jul 2, 2016 · 4 comments
Open

Provide a more flexible vertical positioning #529

teo1978 opened this issue Jul 2, 2016 · 4 comments

Comments

@teo1978
Copy link

teo1978 commented Jul 2, 2016

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

  • the possibility to set a percentage (relative to the height of the viewport)
  • the possibility to center the image vertically (and set a minimum top/bottom margin in px) rather than having a fixed top margin.

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
Copy link

richrd commented Jan 30, 2017

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
Copy link

kess42 commented Feb 2, 2017

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
Copy link

andreich1980 commented Aug 23, 2018

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
Copy link
Owner

lokesh commented Apr 21, 2019

Fix for the mobile issue that caused the scroll to the top behavior will be out shortly and is in the dev branch. PR: #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants