lokesh / lightbox2

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

sizeContainer function issue #476

Closed imacarthur closed 8 years ago

imacarthur commented 9 years ago

I'm not sure if it's a conflict with something on this web site, but I'm having an issue with the sizeContainer function.

the $image.width() and $image.height() are always returned as the size of the outerContainer so the outerContainer never gets resized properly.

outerContainer = 250x250 from the css $image = 960x640 [actual image size & inline style sizes] $image.height() returns 250 $image.height() returns 250

sizeContainer called with 250x250

I added a few lines of code after the preloader.width/height check

    else {
        imageWidth = preloader.width;
        imageHeight = preloader.height;
    }

then changed

self.sizeContainer($image.width(), $image.height());

to

self.sizeContainer(imageWidth, imageHeight);

The real question is why jquery seems to ignore the style="height:x;width:y" when calling the .width() and .height() functions.

jquery version 1.7 [it's a templated site and came with that version]

I opdated to jquery v1.11 with the migrate functions and it's still an issue

$image.height() doesn't return the inline style=height:x

This site also uses mootools [it's an old template] but I don't think there is any conflicts

HunterJoe commented 8 years ago

I ran into this as well. Using LB 2.8.2; Jq 2.1.3

The call to self.sizeContainer($image.width(), $image.height()); always returns 250x250.

Took a while to track this down and figure out why the lightbox was not resizing like it should with my images. I just replaced this: self.sizeContainer($image.width(), $image.height());

with this: self.sizeContainer(preloader.width, preloader.height);

which is essentially what you did as well.

lokesh commented 8 years ago

Closing out old issues that have not seen recent activity.

I'm happy to reopen if others are still seeing the issue and I will then investigate. Thanks.