开发者

IE 8 & 9 not resizing container when width set in image.load

开发者 https://www.devze.com 2023-01-17 05:56 出处:网络
To see the issue go to this pageand click the next text.The small, medium fullsize text will be off to the left (in IE8 or IE9, works fine in Chrome, FireFox) and will not be aligned with the left edg

To see the issue go to this page and click the next text. The small, medium fullsize text will be off to the left (in IE8 or IE9, works fine in Chrome, FireFox) and will not be aligned with the left edge of the image.

Code (http://moments.qa.chucksoft.com/Scripts/mvc/views/show/Showview.js) Line 154:

 ShowView.prototype.setImageSrc = function (imagesrc) {

  var image = $('img#image');
    image.attr('src', imagesrc);
    image.load(function () {
        var container = $('div#imagecontainer');
        container.fadeIn(200);
        var resizer = new Resizer();
        resizer.resize(this.width, this.height, maxWidth, maxHeight);
        var image = $(this);
        var imageWidth = (resizer.width + 23);            
        container.width(imageWidth);
    });
        image.attr('src', imagesrc);
    };

Fr开发者_如何学Goom what I can tell the container.width(imageWidth); is not rendered in IE8 or IE9. If the page is refreshed then it works. Using the built in developer tool shows the correct value in the html but if you use selector tool in the developer tool outline does not reflect the changed width value.

I've tried using vanilla javascript. That did not work. I've tried setting the image source twice. That did not work either.

I'm at a loss on how to fix this issue. Any insights would be much appreciated.

Update

To clarify, the issue arises when you transition from a landscape image to a portrait image, otherwise everything works as expected.

... ?


I have yet to figure this issue out. I have taken a different direction.

0

精彩评论

暂无评论...
验证码 换一张
取 消