The problem here is that .hover() takes two arguments, one for mouseover and one for mouseout.

So it should look like this:

.hover(function() {
  // Stuff to do when the mouse enters the element;
}, function() {
  // Stuff to do when the mouse leaves the element;
});

If you just want to do something on mouseover, use the (appropriately named) .mouseover() method instead:

.mouseover(function() {
  // Stuff to do when the mouse enters the element
})


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Sep 26, 2007, at 9:17 AM, Danjojo wrote:


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");
        });

});


Reply via email to