Question

I'm using this plugin for jquery called resize-crop: http://code.google.com/p/resize-crop/

The problem with this is that sometimes i load the page, and the image is cropped, but not resized.

What's supposed to happen:

What's supposed to happen

What happens sometimes:

enter image description here

When i press refresh, it works again.

Does anyone know where I might be going wrong?

Thanks in advance.

Was it helpful?

Solution

So this is a tricky one to confirm but it seems to me that the image is probably just not done loading sometimes when the plugin runs. The plugin is very simple and hasn't seen any active development for over a year (code) and it doesn't appear to handle any sort of case like that.

Image tags do expose events when they're done loading in some browsers but it isn't exactly reliable, so not sure the best way around this issue. Definitely make sure you're calling the plugin in a $(document).ready callback.

You might try to give the image tag static width and height attributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top