开发者

Jquery: Exclude a contained element

Chouette

I'd like to mouseoverize the div but not the img

开发者_运维技巧$('div').mouseover(go_truc);

How can I do that ?


Handle the mouseenter event, but do nothing if ($(e.target).is('img')).

Then, handle the <img> element's mouseenter event, and undo the effect.


With

function do_trucs() {
  ...
}

function do_machins() {
  ...
  return (false);
}

$('div').mouseover(do_trucs);
$('div img').mouseover(do_machins);

It's working, but is it the simplest/best solution ?

(Anyway I need to handle the img.mouseover for other purpose)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜