Working with Multiple Rollovers

What if you want the image that triggers the rollover to also be a rollover itself? Figure 4.9 builds on the last example and shows how we’ve added this feature. When you roll over one of the invention images, it makes the description image appear, as before, but this time also swaps out the invention image for another image with a drop shadow. This gives the user visual feedback about what they’re pointing at (as if the mouse pointer isn’t enough!). Script 4.10 is the HTML page (no changes except for the title and the name of the external JavaScript file being called), and Script 4.11 shows the additions to the JavaScript from the previous example.

Figure 4.9. When you roll over one of the images, a description ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.