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

Control size of lightbox image? #26

Open
madbaker opened this issue Apr 14, 2020 · 2 comments
Open

Control size of lightbox image? #26

madbaker opened this issue Apr 14, 2020 · 2 comments

Comments

@madbaker
Copy link

Hi. The lightbox image is trying to fill my entire window, no matter the size of the image.

My code:

<div className="image" style={{ width: "100px", display: "block", margin: "auto" }} > <ModalImage small={displayImg} medium={displayImg} alt={description + " #" + number} /> </div>

In my test case, the image in displayImg is a jpg of 500px x 276px . I display the small image at 100px wide (styled within the div) and want the image in the lightbox to be the full 500x276.

The small image displays fine, but the lightbox image blows up to the full size of the window.

Is there any way to control the image size in the lightbox?

@amrancz
Copy link

amrancz commented May 18, 2020

Hi, I'm running into the same issue and haven't found a solution yet. In the demo, this doesn't seem to be an issue, but there I'm not seeing anything in the code that would control the size of the image in the lightbox.

@RokvicSasa
Copy link

RokvicSasa commented Jun 16, 2020

Hi. The lightbox image is trying to fill my entire window, no matter the size of the image.

My code:

<div className="image" style={{ width: "100px", display: "block", margin: "auto" }} > <ModalImage small={displayImg} medium={displayImg} alt={description + " #" + number} /> </div>

In my test case, the image in displayImg is a jpg of 500px x 276px . I display the small image at 100px wide (styled within the div) and want the image in the lightbox to be the full 500x276.

The small image displays fine, but the lightbox image blows up to the full size of the window.

Is there any way to control the image size in the lightbox?

you can control max-width of image in css:

.__react_modal_image__modal_content {
  img {
    max-width: 900px;
  }
}

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

No branches or pull requests

3 participants