开发者

Selecting states an interactive jQuery map

开发者 https://www.devze.com 2023-01-06 20:25 出处:网络
In my project I\'ve included an interactive map, similar to this one : http://davidlynch.org/js/maphilight/docs/demo_usa.html

In my project I've included an interactive map, similar to this one :

http://davidlynch.org/js/maphilight/docs/demo_usa.html

<div class="event_map" style="display: block; background: url('map.png') repeat scroll 0% 0% transparent; position: relative; padding: 0pt; width: 260px; height:241px;">
    <canvas width="260" height="241" style="position: absolute; left: 0pt; top: 0pt; padding: 0pt; border: 0pt none; opacity: 1;" id="image" width:260px;height:241px;=""></canvas>
    <img style="opacity: 0; position: absolute; left: 0pt; top: 0pt; padding: 0pt; b开发者_如何学编程order: 0pt none;" id="image" src="map.png" alt="" class="map" usemap="#state-map" border="0" height="241" width="260">
</div>
<map name="state-map">
    <area shape="poly" alt="" title="State Name" coords="74,18,79,17,80,15,85,13,91,13,93" href="/target/link" target="" />
</map>

So to get started : what should I use as my selector, the image itself or it's area map? Use 'title', or introduce id's for each area ?


If you want to select individual states, you'll want to use the area. It looks like the image is just a single image bkg of the whole map. I'd try to append an id attribute to the area tags if possible, otherwise just use the titles.

$("area[title='CO']").whatever..
0

精彩评论

暂无评论...
验证码 换一张
取 消