tapmodo / Jcrop

Jcrop - The Javascript Image Cropping Engine
https://jcrop.com
Other
4.31k stars 939 forks source link

Not working on IE8 due to .complete when invoked from onloaded #112

Open Marooned-MB opened 11 years ago

Marooned-MB commented 11 years ago

I have IE10 and when testing the site in IE8 mode there is an issue with jCrop due to usage of not very well handled complete property. I'm calling jCrop from onload method of image and jCrop sees complete property set to false. This is a common problem if you google it.

Solution would be not to use this property or do some workaround for IE.

Yeah, we all love IE...

Marooned-MB commented 11 years ago

The workaround for this issue (using jQuery syntax):

var someImage = $('#some-image');
someImage.on('load', function() {
  //here someImage.complete is false for IE8, jCrop loader will fail
  setTimeout(function() {
    //here someImage.complete is true for IE8, jCrop loader will succeed
    someImage.jCrop({...}, function() {...});
  }, 0);
});
chap commented 10 years ago

@Marooned-MB :+1:

RealHacker commented 10 years ago

@Marooned-MB You are my Hero! It's a pity this repo is not well maintained...

colllin commented 10 years ago

@Marooned-MB <3

Marooned-MB commented 10 years ago

Good to hear it's helpful :)