Abhishek Nayak
Abhishek Nayak

Reputation: 3748

How to fix lightbox image size?

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?

Upvotes: 2

Views: 11383

Answers (1)

Ayman Safadi
Ayman Safadi

Reputation: 11552

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.

Upvotes: 3

Related Questions