admin管理员组文章数量:1405392
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 badges3 Answers
Reset to default 3You 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;
}
本文标签: javascriptHow do I resize images in Lightbox2Stack Overflow
版权声明:本文标题:javascript - How do I resize images in Lightbox2? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744317011a2600313.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论