jQuery-rwdImageMaps
jQuery-rwdImageMaps copied to clipboard
Generated Images Not Processing Correctly
Hi there,
I hit some problems with generated images (resized through a server-side action) not returning size info. Looking at the code I noticed some optimisations that could be made using naturalWidth and naturalHeight from the Image DOM object. I revised the start of the load function as follows:
$('<img />').load(function () {
var w = $that[0].naturalWidth,
h = $that[0].naturalHeight;
var wPercent = $that.width() / 100,
hPercent = $that.height() / 100,
map = $that.attr('usemap').replace('#', ''),
c = 'coords';
Dropping out the temp image, this is working reliably on my systems across Chome, IE and Opera (all current versions).
Cheers, Brian