Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing javascript roll overs?

Status
Not open for further replies.

Seminara

Technical User
Jun 9, 2005
36
GB
On the first point, yes, it is technically possible. Whether it would be possible to convert your existing page without too much work, I don't know (I've not looked at your code in depth).

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
On the second point - The amount of data that is required for the image map for a single image most likely would make it not something that you would want to move to a style sheet. You may, however move the map to a separate file as shown below. In addition - since the areas defined by the map are specific to a location - unless you had the same exact location for and image and the clicks were then same - its not worth being placed in a separate style sheet.

That said... If your idea is to drive a set of buttons or "clickable areas" and swapping images, then it might be useful to point to a map using css. see for ideas. Still from my point of view its easier just to add the same usemap to the attributes of the images you want to display.


<img class = "needMap" src = "/myImage.gif" USEMAP = "#myMap">
//note: you can put the map file in a different file and use "file/name#mapname"

<map name = "myMap"
<area shape = "rect" coords = "x1,y1,x2,y2," href = "myHREF1" />
<area shape = "rect" coords = "x1a,y1a,x2a,y2a" href = "myHREF2" />
</map>

Dan - have you ever run across a image css class with usemap defined? i.e. Given that it is an attribute - it may work.
<style>
.needMap {usemap:#myMap;}

Hope this helps - and if the css does work, let us know...
Cheers,
George
 
Seminara, the problem with using CSS to do the hover is that IE doesn't currently support it (IE7 ought to). If that's not a problem for you, then:
Code:
#myDiv { background-image:url('blue.gif'); }
#myDiv:hover { background-image:url('red.gif'); }
...
<div id="myDiv">...</div>
Initially the div will have blue.gif in the background - once you roll over it the background image will be red.gif (and when you roll off it returns to blue.gif).

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
If the image to appear was inside the anchor, it would work fine... and if it was absolutely positioned WRT the anchor, it should be possible in IE with CSS hovers, IMHO.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top