How to fix lightbox image size?

Abhishek Nayak picture Abhishek Nayak · Dec 24, 2011 · Viewed 10k times · Source

I am using lightbox 2 to show in enlarge of images, some picture size are bigger than to browser window size and difficulty to see, so how to fix the lightbox image box size to default?

Answer

Ayman Safadi picture Ayman Safadi · Dec 24, 2011

Maybe you can use CSS. Something like:

#lightbox #imageContainer img {
    max-width: 600px;
}

/*********************************************
 *
 * NOTE: "max-width" is not supported by IE6.
 *       If al your images are bigger than
 *       the "default", just use "width".
 *
 *********************************************/

I would recommend using another lightbox library. My favorite is Colorbox, it actually has an option named scalePhotos, which according to their description:

If true, and if maxWidth, maxHeight, innerWidth, innerHeight, width, or height have been defined, ColorBox will scale photos to fit within the those values.

This option is true by default.