lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.19k stars 1.77k forks source link

Odd problem, perhaps related to jQuery2? #474

Closed saschalalala closed 7 years ago

saschalalala commented 9 years ago

Hey, I had a weird issue with your lightbox application. I had it running in a Shopware4 environment with jQuery 1.7.2 and had to port my theme to Shopware5 which uses jQuery2. The markup is still the same so I expected no problems. <figure> <a href="link_to_the_big_image><img src="small_preview_image" data-lightbox="galleryname"> The image in the lb-container was correct but the size of the outer container was wrong so the data container wasn't replaced at the bottom but just somewhere in the middle of the image. I logged a lot of stuff to debug the problem and realized that something odd was wrong. Long story short, I deleted the size information for the outer container in the css file, that didn't help. What helped was the following, I added: self.$lightbox.find('.lb-outerContainer').width(newWidth); to the postResize function and replaced

if (oldWidth !== newWidth || oldHeight !== newHeight) {
    this.$outerContainer.animate({
    width: newWidth,
    height: newHeight
}, this.options.resizeDuration, 'swing', function() {
    postResize();
    });
    } else {
      postResize();
    }

with postResize(); That works but of course the duration and the swing animation are gone. I had no time yet to narrow the problem but just wanted to report that issue. If you need any further information, let me know and I will provide more information.

Regards, Sascha

lokesh commented 7 years ago

Closing out old issues.

I didn't see other similar reports so hopefully this was a one-off or was fixed by updates to the script over the past year+. Thanks for reporting.

If you still need help, please post your question on Stackoverflow. See more details here: http://lokeshdhakar.com/projects/lightbox2/#help