youmoula / jcrop

Automatically exported from code.google.com/p/jcrop
0 stars 0 forks source link

jcrop does not work on new images in IE8 (images added to page after window load) #32

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. After window has loaded, pull new images in with ajax
2. Create a new jcrop object for each new image

What is the expected output? What do you see instead?

In modern non-IE browsers, each image will be loaded and jcrop will be
instantiated correctly. However, in IE8, images that haven't completed
their load will cause jcrop to fail. This is due to IE's interpretation of
onload. See the following line in attachWhenDone() -

img.onload = function() { $.Jcrop(from,options); };

This can be fixed by replacing the above line with the following -

var onload = function(){ $.Jcrop(from,options); };
function testImg(){
if(img.complete != null && img.complete == true){ 
onload();
return;
}
setTimeout(testImg, 500);
}
setTimeout(testImg, 500);

What version of the product are you using? On what operating system?

jcrop 0.9.8, IE8 Windows XP

Please provide any additional information below.

I am doing multiple-image cropping within an ajax popup. I'm sure this is
more elaborate than most uses of the plugin, but this fix was crucial for
IE to have a chance in our situation. It also stabilized some buggy
behavior in IE6 and IE7.

Thanks,
Chris M

Original issue reported on code.google.com by manni...@gmail.com on 2 Mar 2010 at 1:54