Try adding "return false;" -

$("#myimage").bind("mouseout", function() {
console.log("Hello")
doStuff();
return false;
});

-- Josh



----- Original Message ----- 
From: "Fabien Meghazi" <[EMAIL PROTECTED]>
To: "ML:jQuery" <jquery-en@googlegroups.com>
Sent: Thursday, September 20, 2007 3:13 PM
Subject: [jQuery] Image + map area + mouseout event


> 
> Hi all,
> 
> I've got an image with a map area defined for it. Eg:
> 
> <img id="myimage" src="img/myimage.gif" width="260" height="219"
> border="0" usemap="#myimage_map"/>
> 
> <map name="myimage_map" id="myimage_map">
> <area href="#" alt="foo" shape="polygon" coords="233, 135, 219, ...">
> <area href="#" alt="bar" shape="polygon" coords="13, 125, 319, ...">
> ...
> </map>
> 
> I've got a mouseout event binded to the image itself :
> 
> $("#myimage").bind("mouseout", function() {
> console.log("Hello")
> doStuff();
> });
> 
> My problem is that when the cursor is over an area in the image, the
> mousout event of the image is called. (probably because of those event
> bubbling/capturing I never understoof how to deal with). I tried
> event.stopPropagation() and event.preventDefault() without success.
> 
> Is there a way to avoid that behaviour ?
> 
> -- 
> Fabien Meghazi
> 
> Website: http://www.amigrave.com
> Email: [EMAIL PROTECTED]
> IM: [EMAIL PROTECTED]

Reply via email to