javascript - How do I resize images in Lightbox2? - Stack Overflow

I'm using . I have image thumbnails and on clicking them they open in lightbox - obviously.The is

I'm using /. I have image thumbnails and on clicking them they open in lightbox - obviously.

The issue I have is that when some of those images are 1800x1200, lightbox covers the whole webpage.

How can I edit to ensure that the images are a maximum height of let's say 400px and width is in proportion? I can't simply upload the images in lower dimensions as they are user uploaded images, so I need to do this script/server side.

Thanks!

I'm using http://lokeshdhakar./projects/lightbox2/. I have image thumbnails and on clicking them they open in lightbox - obviously.

The issue I have is that when some of those images are 1800x1200, lightbox covers the whole webpage.

How can I edit to ensure that the images are a maximum height of let's say 400px and width is in proportion? I can't simply upload the images in lower dimensions as they are user uploaded images, so I need to do this script/server side.

Thanks!

Share Improve this question asked Oct 30, 2012 at 2:42 DaveDave 6872 gold badges11 silver badges26 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

You can use the max-width and max-height CSS properties on both the images and the lightbox:

Demo: http://jsfiddle/rdfAV/1/

CSS:

img {
    max-width: 400px;
    max-height: 400px;
}

.lb-outerContainer, .lb-dataContainer {
    max-width: 420px;
    width: auto!important;
    height: auto!important;
}​

This method appears to be patible with all major browsers, a full patibility list is available here: http://caniuse./#feat=minmaxwh

Please try adding the following to your CSS:

 .lb-image{
      max-width: inherit;
  }

Thanks A Lot .. Really Help Full To My Landing Page

Some Editied Code , Play Wisely

img {
max-width: 800px;
max-height: 600px;
}

.lb-outerContainer, .lb-dataContainer {
max-width: 800px;
width: auto!important;
height: auto!important;
}​

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744317011a4568232.html

相关推荐

  • javascript - How do I resize images in Lightbox2? - Stack Overflow

    I'm using . I have image thumbnails and on clicking them they open in lightbox - obviously.The is

    7天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信