Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery image map alternative

What is an alternative to using image maps? I saw a question recently and someone said, "Why are people still using image maps?" and I wanted to know a good CSS or JavaScript solution to see for myself if its better to use than an image map.

like image 732
Kieran Andrews Avatar asked Mar 04 '11 06:03

Kieran Andrews


3 Answers

CSS is the way to go when working with image maps. You can easily position a link with desired width and height over any area of the image by changing top left width height values.

Check a working example at http://jsfiddle.net/DBvAY/1/

In the example, Hover over the babies face or the red light in the image. To change the position of the anchors all you need to do is modify the top and left properties of #pos1 and #pos2. Same goes for width and height of the bounding box. All done with CSS with no javaScript.

like image 153
Hussein Avatar answered Nov 20 '22 17:11

Hussein


you only need to put the ID's on the anchors, the divs are not required.

like image 2
user102030 Avatar answered Nov 20 '22 18:11

user102030


If your website is responsive, you might want to try using SVG as an excellent alternative to image maps.

SVGs can easily be made responsive and also respond to hover effects, etc.

This is a nice article that discusses the matter.

like image 2
bmunslow Avatar answered Nov 20 '22 18:11

bmunslow