Skip to content
New issue

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

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

Already on GitHub? # to your account

Image is not shown in full size even though the window would be large enough #317

Open
1 of 3 tasks
JanSellner opened this issue Jul 30, 2017 · 0 comments
Open
1 of 3 tasks

Comments

@JanSellner
Copy link

JanSellner commented Jul 30, 2017

What kind of issue is this? (put 'x' between the square brackets)

I noticed that images are not shown in full size when the lightbox is open even though the window would be large enough. This is especially visible for images showing text. Here is a fiddle showing the problem: http://jsfiddle.net/rwwtv2az/2/ (you have to remove the javascript part to see the problem).

The problem is caused by the -1 in the ratio calculation of the resize function

/* Note: -1 to avoid rounding errors */
var ratio = Math.max(
    w  / (this.$content.parent().width()-1),
    h / (this.$content.parent().height()-1));

It states that this is due to rounding errors but it causes the ratio to be slightly above 1 and hence makes the image slightly smaller.

In the fiddle I fixed this issue by applying the procedure only if the image is smaller than the parent. If you think this is a proper way of fixing the problem, I could make a PR.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant