简体   繁体   中英

How can I change the default image size of this lightbox #lightbox2?

I'm trying to build a gallery website an i'm using the lightbox2 of this guy: https://lokeshdhakar.com/projects/lightbox2/

Can somebody tell me, where I can change the default image size? I want the picture in full screen size. The default image size is to small.

JS: I can't post the whole JS Code because it's to big and i don't know which part it is. But you can find the JS code here: https://github.com/lokesh/lightbox2/blob/dev/dist/js/lightbox-plus-jquery.min.js

CSS:

.lb-loader,
.lightbox {
    text-align: center;
    line-height: 0;
    position: absolute;
    left: 0
 }

 body.lb-disable-scrolling {
    overflow: hidden
 }

 .lightboxOverlay {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    background-color: #000;
    filter: alpha(Opacity=80);
    opacity: .8;
    display: none
 }

.lightbox {
    width: 100%;
    z-index: 10000;
    font-weight: 400;
    outline: 0
 }

 .lightbox .lb-image {
    display: block;
    height: auto;
    max-width: inherit;
    max-height: none;

    border: 4px solid #fff
 }

 .lightbox a img {
    border: none
 }

 .lb-outerContainer {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto;
    border-radius: 4px;
    background-color: #fff
  }

.lb-outerContainer:after {
   content: "";
   display: table;
   clear: both
 }

.lb-loader {
   top: 43%;
   height: 25%;
   width: 100%
}


.lb-dataContainer {
    margin: 0 auto;
    padding-top: 5px;
    width: 100%;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px
 }

.lb-dataContainer:after {
    content: "";
    display: table;
    clear: both
 }

.lb-data {
    padding: 0 4px;
    color: #ccc
 }

.lb-data .lb-details {
    width: 85%;
    float: left;
    text-align: left;
    line-height: 1.1em 
 }

.lb-data .lb-caption {
    font-size: 13px;
    font-weight: 700;
    line-height: 1em
 }

What if you change the options to fitImagesInViewport:true options are here

Or change the css to have responsive img based on the size of the container?

img{
width: 100%;
height: auto;
}
.image-container{
 width: 100vw;
 height: 100%;
}

html

 <div class="image-container">
    <img src="https://picsum.photos/id/1025/200/300" />
 </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM