Last active
February 14, 2024 05:02
-
-
Save mrdoob/e69fd7009736f2ba99a8968c682a8653 to your computer and use it in GitHub Desktop.
Revisions
-
mrdoob renamed this gist
Oct 1, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mrdoob created this gist
Oct 1, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // @mrdoob: Can't believe image maps aren't responsive window.onload = function () { var image = document.getElementById( 'image' ); var delta = image.clientWidth / 1024; var map = document.getElementById( 'map' ); var areas = map.getElementsByTagName( 'area' ); for ( var i = 0; i < areas.length; i ++ ) { var area = areas[ i ]; var coords = area.coords.split( ',' ); for ( var j = 0; j < coords.length; j ++ ) { coords[ j ] *= delta; } area.coords = coords.join( ',' ); } }