I'm using an Image of all counties in Texas on webpage using
<img src="https://txbbw.ml/static/images/jibh.png" width="100%" usemap="#image-map">
<map name="image-map">
<area target="" alt="Caldwell" title="Caldwell" href="https://txbbw.ml/map/Caldwell/-96.7177005/30.5307282" shape="poly" coords="2146, 2860, 2552, 3200, 2942, 2990, 2483, 2599"/>
<area target="" alt="Gonzales" title="Gonzales" href="https://txbbw.ml/map/Gonzales/-97.4772359/29.5048146" shape="poly" coords="2946, 2997, 2556, 3213, 2503, 3183, 2202, 3590, 2535, 3920, 3046, 3538, 3098, 3374, 3095, 3262, 3193, 3186" />
<area target="" alt="Karnes" title="Karnes" href="https://txbbw.ml/map/Karnes/-97.915897/28.8880769" shape="poly" coords="2538, 3915, 2337, 4068, 2585, 4327, 2312, 4525, 2291, 4510, 2217, 4506, 2113, 4449, 1992, 4495, 1752, 4231, 2379, 3771" />
<area target="" alt="Bee" title="Bee" href="https://txbbw.ml/map/Bee/-97.7862049/28.409946" shape="poly" coords="2118, 4466, 2217, 4528, 2309, 4538, 2410, 4702, 2466, 4754, 2593, 4745, 2615, 4831, 2700, 4878, 2710, 4866, 2847, 4928, 2600, 5260, 2271, 5196, 1885, 4536" />
<area target="" alt="SAN PATRICIO" title="SAN PATRICIO" href="https://txbbw.ml/map/SAN PATRICIO/-97.7745336/27.9576203" shape="poly" coords="2257, 5207, 2149, 5294, 2193, 5382, 2304, 5394, 2278, 5508, 2622, 5612, 2874, 5606, 3098, 5670, 3177, 5576, 3002, 5336, 2875, 5282, 2719, 5235, 2601, 5282" />
<area target="" alt="Nueces" title="Nueces" href="https://txbbw.ml/map/Nueces/-97.6620641/27.7887978" shape="poly" coords="2239, 5500, 2105, 5612, 2099, 5937, 2184, 5973, 2236, 6049, 2927, 6051, 3033, 5881, 2879, 5841, 2838, 5715, 2521, 5645" />
<area target="" alt="Kleberg" title="Kleberg" href="https://txbbw.ml/map/Kleberg/-97.8969139/27.5028167" shape="poly" coords="2219, 6064, 2091, 5962, 1925, 5956, 1932, 6457, 2045, 6527, 2815, 6371, 2930, 6058" />
<area target="" alt="Refugio" title="Refugio" href="https://txbbw.ml/map/Refugio/-97.2935169/28.3080144" shape="poly" coords="2650, 5214, 2874, 4919, 3166, 4693, 3315, 4720, 3492, 4794, 3532, 4779, 3680, 4876, 3657, 4998, 3192, 5090, 3314, 5190, 3053, 5336, 2858, 5233" />
<area target="" alt="Galveston" title="Galveston" href="https://txbbw.ml/map/Galveston/-94.9566483/29.393116" shape="poly" coords="6105, 3851, 5825, 3435, 5843, 3315, 5914, 3397, 6103, 3320, 6386, 3230, 6403, 3358, 6642, 3385, 6977, 3269, 6999, 3335, 6534, 3509, 6512, 3641" />
<area target="" alt="Harris" title="Harris" href="https://txbbw.ml/map/Harris/-95.3760728/29.762121" shape="poly" coords="5946, 3366, 6217, 3076, 6228, 2940, 6112, 2829, 6094, 2733, 5999, 2475, 5784, 2663, 5696, 2676, 5471, 2562, 5374, 2484, 5069, 2601, 4826, 2491, 5004, 2981, 5553, 3265, 5762, 3231" />
<area target="" alt="Sabine" title="Sabine" href="https://txbbw.ml/map/Sabine/-93.8547083/31.343520" shape="poly" coords="7457, 1131, 7636, 1099, 8064, 1069, 7812, 452, 7398, 552" />
<area target="" alt="Newton" title="Newton" href="https://txbbw.ml/map/Newton/-93.7616915/30.8510301" shape="poly" coords="7637, 1107, 8061, 1077, 8181, 1295, 8049, 1778, 7893, 1941, 7877, 2226, 7919, 2353, 7648, 2361, 7702, 1390" />
<area target="" alt="Jasper" title="Jasper" href="https://txbbw.ml/map/Jasper/-94.0266033/30.9249516" shape="poly" coords="7636, 1106, 6885, 1241, 6895, 1315, 7157, 1263, 7295, 1587, 7353, 1739, 7448, 1815, 7391, 1903, 7361, 2133, 7357, 2360, 7646, 2358, 7696, 1395" />
<area target="" alt="Orange" title="Orange" href="https://txbbw.ml/map/Orange/-93.7478422/30.0918584" shape="poly" coords="7351, 2364, 7384, 2423, 7355, 2477, 7412, 2523, 7387, 2588, 7473, 2618, 7472, 2649, 7742, 2745, 7976, 2549, 7939, 2364" />
<area target="" alt="Jefferson" title="Jefferson" href="https://txbbw.ml/map/Jefferson/-94.3525849/32.7622043" shape="poly" coords="7027, 3221, 7023, 2850, 6904, 2852, 6902, 2543, 7064, 2548, 7137, 2508, 7137, 2464, 7271, 2447, 7345, 2471, 7404, 2534, 7386, 2579, 7481, 2655, 7711, 2736, 7490, 2984, 7298, 3117" />
</map>
I'm able to click on few counties such as Harris, Bee ,etc. but not on other, what might be wrong here?
I'm using https://summerstyle.github.io/summer/ to create polygons
I'm hoping to have a hover effect, preferably a border color or glow around the poly area on this image map. Below is my Javascript:
<script>
window.onload = function () {
var ImageMap = function (map, img) {
var n,
areas = map.getElementsByTagName('area'),
len = areas.length,
coords = [],
previousWidth = 700;
for (n = 0; n < len; n++) {
coords[n] = areas[n].coords.split(',');
}
this.resize = function () {
var n, m, clen,
x = img.offsetWidth / previousWidth;
for (n = 0; n < len; n++) {
clen = coords[n].length;
for (m = 0; m < clen; m++) {
coords[n][m] *= x;
}
areas[n].coords = coords[n].join(',');
}
previousWidth = img.offsetWidth;
return true;
};
window.onresize = this.resize;
},
imageMap = new ImageMap(document.getElementById('map_ID'), document.getElementById('img_ID'));
imageMap.resize();
return;
}
</script>
And the HTML that includes the coordinates for the sections that I would like highlighted on hover:
<div style="width:100%;">
<img id="img_ID" src="http://libraries.adelphi.edu/files/2016/10/Overview-Final.jpg" usemap="#map" border="0" width="100%" alt="" />
</div>
<map id="map_ID" name="map">
<area shape="poly" coords="133,309,70,330,68,347,199,392,239,373,193,364,191,342,209,340,209,329" alt="Level S" title="Level S" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-S-10-2016.jpg" target="_self" />
<area shape="poly" coords="244,310,200,324,64,286,64,267,146,243,207,257,208,294,241,293" alt="Level 2S" title="Level 2S" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-2S-10-2016.jpg" target="_self" />
<area shape="poly" coords="193,344,194,356,350,406,469,343,469,328,319,295,294,319,253,343,236,341" alt="Level C" title="Level C" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-C-10-2016.jpg" target="_self" />
<area shape="poly" coords="188,236,188,252,350,287,673,162,674,153,500,136,355,174,291,167,291,221,240,241,218,236" alt="1st Floor" title="1st Floor" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Floor1-10-2016.jpg" target="_self" />
<area shape="poly" coords="187,233,186,250,60,221,61,208,165,180,204,184,207,226,205,232" alt="Level 3S" title="Level 3S" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-3S-10-2016.jpg" target="_self" />
<area shape="poly" coords="237,171,190,180,54,156,56,142,166,116,202,120,204,128,182,127,182,149,205,151,233,158" alt="Level 4S" title="Level 4S" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-4S-10-2016.jpg" target="_self" />
<area shape="poly" coords="184,129,184,147,350,172,679,88,680,77,433,58,291,78,291,119,213,131" alt="2nd Floor" title="2nd Floor" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Floor2-10-2016.jpg" target="_self" />
<area shape="poly" coords="235,98,188,104,51,88,51,74,166,51,201,54,201,80,236,83" alt="Level 5S" title="Level 5S" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-5S-10-2016.jpg" target="_self" />
</map>
Is there a Javascript or CSS solution?
This is a rough example of what I'm trying to achieve:
http://www.outsharked.com/imagemapster/default.aspx?demos.html
you are try to "onMouseOver" and "onMouseOut".
example
<map id="map_ID" name="map">
<area shape="poly" coords="133,309,70,330,68,347,199,392,239,373,193,364,191,342,209,340,209,329" alt="Level S" title="Level S" href="http://libraries.adelphi.edu/files/2016/10/Swirbul-Level-S-10-2016.jpg" target="_self"
onMouseOver="if(document.images) document.getElementById('map_ID').src= ' Over Image URL';"
onMouseOut="if(document.images) document.getElementById('map_ID').src= 'Out Image URL';"
/>