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

Feature: consider caption outside when calculating the value "top" #104

Open
nom10s opened this issue Aug 31, 2018 · 4 comments
Open

Feature: consider caption outside when calculating the value "top" #104

nom10s opened this issue Aug 31, 2018 · 4 comments
Assignees

Comments

@nom10s
Copy link

nom10s commented Aug 31, 2018

Thank you very much for the great work!

I have a suggestion: Please consider the value "outside" for the property "options.captionPosition" when calculating the value "top". Since at the time of calculation it will be unknown how high the "sl-caption.pos-outside" will be, an option would be desirable to adjust the distance of the image to the upper edge ("top").

In simple-lightbox.js (v 1.13.0), line 234, this does the job for me
top': ( $( window ).height() - imageHeight ) / 2 + 70 + 'px',
where 70 is half the height of "sl-caption.pos-outside".
Maybe you have a better idea to solve the problem.

Have a nice day.
Stefan

@NjamNjamNjam
Copy link

Dear Andre,

I enjoy your great work as well and would like to support this request.
Sometimes I add short description to images and most of the text is cut off in landscape format.
I'm not good at programming and can't modify the code to achieve that.

Thank you very much.

@andreknieriem
Copy link
Owner

It is a little bit tricky to do this. I will take a look.

@g000m
Copy link

g000m commented Feb 6, 2024

I was just about to open a new issue, & found this related.

I'm having trouble when large images (already constrained to heightRatio: .85) don't leave enough space at the bottom of the screen for long captions to fit on the page.

I know that a challenge here is that the size of the caption element would need to be rendered to be measured. But it also looks like the image position is calculated (here) before the caption is built.

A simple resolution might be a setting that allows the top edge of the image to be positioned at the top of the page, instead of calculated to appear centered vertically. But that still wouldn't help for excessively long captions.

Any thoughts on approaches for resolving this?

@janisdd
Copy link

janisdd commented Feb 13, 2024

I "solved" the problem by reducing the image height by the height of the caption.
This looks a bit ugly (the width of the caption still corresponds to the width of the original image), but it works.

simpleLightBoxOutsideCaption

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