compact / angular-bootstrap-lightbox

An AngularJS lightbox built using UI Bootstrap Modal.
http://compact.github.io/angular-bootstrap-lightbox/
MIT License
306 stars 134 forks source link

can't show images on ios. #5

Closed daniymilner closed 10 years ago

daniymilner commented 10 years ago

Hi, I have a problem with images on ios. Images has with width=1px height=0px. I can resolve it with getting height and width on image.onload in lightboxSrc directive.

was

var image = new Image();
image.src = src;

// these variables must be set before resize(), as they are used in it
imageWidth = image.naturalWidth;
imageHeight = image.naturalHeight;

resize();

I do

var image = new Image();
image.src = src;
image.onLoad = function(){
    imageWidth = image.naturalWidth;
    imageHeight = image.naturalHeight;
    resize();
};

it's work, but I don't know, is it good solution.

compact commented 10 years ago

That is a good solution. I replicated and fixed this problem in iOS 8.1 Chrome 38 (the problem didn't appear in Safari).