As an aside, you might consider streamlining your code a little. Instead of
having one method for each image, just do something like this:
<img src="images/originalimage.jpg" rel="images/cylinder.jpg"
class="swapImages" />
<img src="images/originalimage_02.jpg" rel="images/mgp_swap.jpg"
class="swapImages" />
Then your jQuery code can look like this:
$(".swapImages").hover(function() {
var newSRC = $(this).attr("rel");
$(this).attr("src",newSRC);
});
That new method covers ALL the images, as long as you've got the new src set
inside the rel attribute of the image tag.
Just something to consider. It's always a good thing when you can condense
code.
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Danjojo
Sent: Wednesday, September 26, 2007 8:17 AM
To: jQuery (English)
Subject: [jQuery] g has no properties?
I am doing a simple imageChange onLinkHover...
I get the following error in Firebug everytime I hover over a link.
But the image swaps work GREAT in all browsers.
Except for the fact I see the error getting thrown in the browsers I am
fine.
g has no properties
handleHover(Object type=mouseout target=a.showPic)jquery-svn.js (line
11)
e(Object type=mouseout target=a.showPic)jquery-svn.js (line 11)
e()jquery-svn.js (line 11) [Break on this error]
eval(function(p,a,c,k,e,r){e=function(c)
{return(c<a?'':e(parseInt(c/a)))+((c=c%a...
The jQuery code to swap images is:
$(".showPic").hover(function() {
$("#imgLinkAct").attr("src", "images/cylinder.jpg");
});
$(".showPic2").hover(function() {
$("#imgLinkAct").attr("src", "images/mgp_swap.jpg");
});
$(".showPic3").hover(function() {
$("#imgLinkAct").attr("src", "images/mhc_swap.jpg");
});
$(".showPic4").hover(function() {
$("#imgLinkAct").attr("src", "images/shock_swap.jpg");
});
$(".showPic5").hover(function() {
$("#imgLinkAct").attr("src", "images/emy2_swap.jpg");
});
$(".showPic6").hover(function() {
$("#imgLinkAct").attr("src", "images/ncy2_swap.jpg");
});
$(".showPic7").hover(function() {
$("#imgLinkAct").attr("src", "images/crq_swap.jpg");
});
$(".showPic8").hover(function() {
$("#imgLinkAct").attr("src", "images/clean_room_swap.jpg");
});
});