jQuery: using hover to roll-over multiple images at once.

Posted by WillKop on Stack Overflow See other posts from Stack Overflow or by WillKop
Published on 2010-05-28T07:00:44Z Indexed on 2010/05/28 7:31 UTC
Read the original article Hit count: 171

Filed under:
|

I have a small problem, but I'm a bit stumped.

I am using the following code to do rollovers on my webpage

$("#mylink1 img").hover(
 function()
 {
  this.src = this.src.replace("_off","_on");
 },
 function()
 {
  this.src = this.src.replace("_on","_off");
 }
);

This works great for individual images, but I would like to roll over one of them and have the the other one change as well.

<a id="mylink1" href="about.cfm"><img src="images/Home_top_navs/aboutus_manage_off.gif" /></a>

<a id="mylink1" href="about.cfm"><img src="images/Home_top_navs/aboutus_nav2_off.gif" /></a>

Any help would be appreciated! Thank you!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about rollover