.width() of image returning 0 on load event
- var img_large = new Image();
-
- $(img_large).load(function () {
-
- $(".image_enlarge_container").append(this);
-
- alert($(img_large).width());
- //load of code
-
- }).error(function () {
- // notify the user that the image could not be loaded
- }).attr('src', large_src);
- }
In dreamweaver this works fine every time.
In IE 8 the width in the alert is always 0 (but the height seems to be ok??)
In chrome, it works fine once, but all other times after that (I have it so that the image is inserted into a dynamically created div on a mouseenter and removed on a mouseleave) the alert returns 0
Any insight as to what on earth is going on here would be greatly appreciated, thanks!