I have an image on a web page that also requires links. I am using an image map to create the links and I am wondering if there is a way to style the area shape on mouseover for a minor touch of interactivity. Is this possible?
I tried this without success:
html
<img src="{main_photo}" alt="locations map" usemap="#location-map" />
<map name="location-map">
<area shape="rect" coords="208,230,290,245" href="{site_url}locations/grand_bay_al" />
<area shape="rect" coords="307,214,364,226" href="{site_url}locations/mobile_al" />
<area shape="rect" coords="317,276,375,290" href="{site_url}locations/loxley_al" />
</map>
css
area { border: 1px solid #d5d5d5; }
Any suggestions?
CSS Only:
Thinking about it on my way to the supermarket, you could of course also skip the entire image map idea, and make use of
:hoveron the elements on top of the image (changed the divs to a-blocks). Which makes things hell of a lot simpler, no jQuery needed…Short explanation:
Example:
Original Answer using jQuery
I just created something similar with jQuery, I don’t think it can be done with CSS only.
Short explanation:
#mapis on top (absolute position) (to prevent call tomouseoutwhen the rollovers appear)Hope it helps..