-
Notifications
You must be signed in to change notification settings - Fork 291
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
Big images #43
Comments
I'm really stumped by this issue 😦 |
Posted question on StackOverflow. |
One possibility would be, to place the Image as the background of the container and use background-size: contain; and hide the actual image (visibility: 0), that would probably leave the possibility to still rightclick and download it and it helps keep the box wide. |
Checkout the development branch :) I have much improved iframe and image handling. Also, there is now no width anymore... Think should make you happy. And i fixed the background bleeding issue. If it's okay, I'll remove the next branch, or do you have any changes there that's not yet in master? |
Which development branch? The master branch has changes for iframe (not related to this issue) and a As for the |
You are right, forgot to publish the development branch: https://github.com/noelboss/featherlight/tree/development z-index should fix the buttons bleeding trough the background... I have to check the next-branch, but probably only next week :) |
The I posted this answer on SO: It's bound to be related to the flow of things, like how reducing the width of a The clipping here is due to the fact that the If one still wants a border, then it can be faked by adding an absolutely positioned |
I'm not sure what the default should be for |
Mmm, my "solution" doesn't even work on Firefox. |
Resorted to using Javascript. Improved the handling of callbacks & animations to insure that image is loaded beforehand. Added a JS solution in the wiki: https://github.com/noelboss/featherlight/wiki/Resize-images-to-fit Should we turn this into an option? It would add maybe ~16 lines of JS |
Did you ever get a solution for this? |
I've come up with an alternative, and in my humble opinion cleaner, solution. This CSS will work in Chrome: .featherlight .featherlight-image{
max-width:100%;
max-height:100%;
width:auto;
} but not in Firefox. The reason being, that So, my solution calculates and sets that height when the lightbox is opened, then unsets it when the lightbox closes (in case the user resizes the window): $.featherlight.defaults.afterClose = function(){
$(".featherlight-content").css('height','');
};
$.featherlight.defaults.afterOpen = function resizeFeatherlight(){
var $flc = $(".featherlight-content");
$flc.css('height',$flc.height()+'px');
} It's a bit brute-force, but it works, and I think it's less code than @marcandre's solution (not that that code doesn't do the job - I just mention this in the interest of keeping the codebase as small as possible). I've tested this in Firefox and Chrome. IE remains a mystery. As for whether this functionality should be an option: I don't think it should be optional. I think it should be the default behaviour. I've never seen any other lightbox library that doesn't resize images to screen, because the whole point of a lightbox is to see the whole image. |
I agree this should be the default.
Does this means it works in IE, or that you don't know if it does? |
Sorry - in retrospect that was a little cryptic. What that means is I haven't tested it in IE. |
@quasipickle Sorry it took so much time before I looked at your solution. Even in Chrome, though, it doesn't quite work with the borders. |
+1 to this being the default. I also had trouble getting the example code provided here to work. |
Is there a (final) solution on the horizon? Will featherlight be updated to have the image fit completely into the lightbox? |
I have a small JS solution, which is not perfect and is a little jumpy. Simply change the afterOpen and afterClose methods to the following:
|
Do we have a solution to this? I don't want large images to have to be scrolled. |
I'm actively working on a solution for this, hope to get it out in a few days. |
+1 |
Merged in master, should release shortly. |
💯 x1000 👍 |
I've been experiencing scroll bars on vertical images that don't fit within the viewport as well. Using v1.2.3, which I'm assuming is the latest master branch, and still have the problem. Anyone else still having this happen as well? |
@elixirgraphics Probably the issue with bootstrap which I haven't checked yet. See #117 for a solution. |
Scrap that. It only seemed to clear up the issue temporarily. I'll look into #117 and see if that fixes my problem. |
Any progress on this one? |
@MickeyKay this issue is closed... |
Right, I saw that. But the issue is not resolved and I can't find a full-on explanation of resolution elsewhere. Please see #166 for the same issue still happening. |
_callbackChain onResize function (near the bottom of plugins.js line 569) Change:
to
The 50 is to take into account the padding (25 top + 25 bottom and 25 left + 25 right) |
Thanks @KodeStar, that fixes the issue for me as well. |
Is this project still maintained? @KodeStar's snippet fixed the issue for me as well, and I'm surprised it hasn't been merged to master. Happy to whip up a PR if a maintainer will accept it. cc @marcandre, @noelboss |
I'll definitely accept a PR, but would be best without the hardcoded "50"s, and instead getting those from the CSS somehow |
replace .featherlight-image { add overflow: hidden; to your existing code in These small css changes did the trick. No vertical scrollbar anymore :) Maybe you need slightly less than 90vh |
Two issues with big images (i.e. images that won't fit the current window) in
featherlight
.The main issue is that if the image doesn't fit width-wise, it will be resized (great!), but if it doesn't fit height-wise, it gets cut and one needs to scroll.
It makes sense for a general lightbox to allow scrolling but for images it's not really what we want (or at least what I want 😃 ).
My CSS skills aren't good enough to find a solution (either for a wiki entry or modification of the official css). I played around a bit and tried clearing
width
and setting bothmax-width
andmax-height
to 100% but it doesn't quite work. Somehow the height is too big.The second issue is that the behavior for IE (at least for IE 9) is different, and the image gets squished.
@noelboss can you find a solution for these?
The text was updated successfully, but these errors were encountered: