').attr('src', $(that).attr('src')).load(function() { var w, h; // jQuery < 1.6 incorrectly uses the actual image width/height instead of the attribute's width/height if (v < 1.6) w = $(that)[0].getAttribute('width'), h = $(that)[0].getAttribute('height'); else w = $(that).attr('width'), h = $(that).attr('height'); var wPercent = $(that).width()/100, hPercent = $(that).height()/100, map = $(that).attr('usemap').replace('#', ''), c = 'coords'; $('map[name="' + map + '"]').find('area').each(function() { if (!$(this).data(c)) $(this).data(c, $(this).attr(c)); var coords = $(this).data(c).split(','), coordsPercent = new Array(coords.length); for (var i = 0; i < coordsPercent.length; ++i) { if (i % 2 === 0) coordsPercent[i] = parseInt(((coords[i]/w)*100)*wPercent); else coordsPercent[i] = parseInt(((coords[i]/h)*100)*hPercent); } $(this).attr(c, coordsPercent.toString()); }); }); }); }; rwdImageMap(); $(window).resize(function() { rwdImageMap(); }); };