I'm writing a jQuery plugin that handles a bunch of image animations with a simple call to the plugin function (something like $("#image1").anims()
where #image1
is an image), however as part of the plugin's functionality I use $(this).width()
to get the width of the image right at the start of the function call.
But, since the plugin function is called in $(document).ready
, it's trying to get the width of the image before the image has loaded, so it's always returning 0. Is there a workaround for this?