natashawylie / iviewer

image viewer plugin for jquery
233 stars 97 forks source link

Issue with loading new images and new sizes not being picked up #11

Closed SamStephens closed 13 years ago

SamStephens commented 13 years ago

When I load a new image using the iviewer.loadImage() function, the image picks up the size of the previous image.

Looking at the code, the issue in the loadImage() function.

this.img_object.object.unbind('load').
    removeAttr("src").
    removeAttr("width").
    removeAttr("height").
    css({ top: 0, left: 0 }).
    load(function(){

The problem is that the width and height are not controlled by the width and height attributes, but by inline CSS width and height.

I've fixed this issue locally by replacing the css() line with

    css({ top: 0, left: 0, width: '', height: '' }).
can3p commented 13 years ago

Thanks for the issue, I've fixed it in the code