suchen

Heim  >  Fragen und Antworten  >  Hauptteil

javascript - 如何关闭js的事件捕获

最外层p里面有几个小p,最外层p绑定了一个mouseover事件,当鼠标进入p时事件被触发多次,怎样才能使事件仅触发一次

天蓬老师天蓬老师2894 Tage vor678

Antworte allen(2)Ich werde antworten

  • PHPz

    PHPz2017-04-10 12:45:54

    在jquery中
    mouseenter和mouseover分别对应你需要的场景和你目前的场景
    mouseenter会忽略子元素,而mouseover不会
    http://www.w3school.com.cn/tiy/t.asp?...
    在js本身的addEventListener里有相关参数useCapture,即是否捕获冒泡
    http://www.cnblogs.com/_franky/archiv...

    Antwort
    0
  • 天蓬老师

    天蓬老师2017-04-10 12:45:54

    jquery的话 第一事件 return false 后面的就不会触发了

    Antwort
    0
  • StornierenAntwort