Forum Moderators: open

Message Too Old, No Replies

Image map, changes image on hover?

         

FlyingMonkieBoy

8:09 am on Jun 29, 2008 (gmt 0)

10+ Year Member



I'm a noob, and i'm not even sure if this is html or css, but I am trying to find out how to make an image map that when you hover over a certain area on the pic, it will change the entire picture. Thanks

tedster

8:39 am on Jun 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello FMB, and welcome to the forums.

I would not suggest using an actual html image map - there are major accessibility issues, and I even suspect some search engine issues that haven't gone away.

But you can get the same effect by nesting two divs for each section, with defined width and height. Then position:absolute will get the nested pair positioned right where you need them. Use your default image as a background-image for the outer div.

Then the inner div holds your actual link - which can be anchor text that you wrap in a tag defined as visibility:hidden. CSS can now define a hover behavior that uses a new background image for the anchor element in the inner div.

It may sound complex, but play around with it for a while, and you'll see how it works. There are some tutorials around the web for coding an "image map hover" that will take you step by step, if you want that. I prefer working through it on my own - it sets the concepts in my brain.

You say your are a noob, so this might be a bit much to bite off - especially if your css and html chops are just growing. But a project like this will grow them up pretty fast!

FlyingMonkieBoy

1:55 am on Jun 30, 2008 (gmt 0)

10+ Year Member



hmm i kinda understand but not really...
I am trying to make a sidebar to a site that has a list of links and when you hover over a certain link, the sidebar will change to a different picture, but same size and all...

tedster

3:26 am on Jun 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use a CSS rule to change background-image or background-color for the anchor tag when someone hovers.

Unless you want the complete background to change for the entire sidebar when just one link is hovered. Then you will need some Javascript to access the DOM and switch styles for the sidebar container so the background changes all over.