简体   繁体   English

从svg> rect元素取消绑定工具提示

[英]Unbind a tooltip from a svg>rect element

In the contributions calendar heatmap at https://github.com/ben174?tab=contributions&from=2015-01-27 - I can't seem to figure out how to unbind the tooltip mouseover. https://github.com/ben174?tab=contributions&from=2015-01-27的贡献日历热图中-我似乎无法弄清楚如何解除工具提示鼠标悬停的绑定。

It's like it's showing up without any event bindings, but I can't figure out how that's possible. 就像没有任何事件绑定的情况一样,但是我不知道这是怎么可能的。

Some things I've tried: 我尝试过的一些事情:

$("svg rect").unbind("mouseover")
$("svg").unbind("mouseover")

If you look at the parent <div> to the <svg> , 如果您查看<svg>的父<div> <svg>

<div class="js-calendar-graph ...etc...">

there are mouseover and mouseout events attached to that. 有附加的mouseover和mouseout事件。 Disabling that mouseover stopped the tooltips appearing for me. 禁用鼠标悬停会停止为我显示工具提示。

After poking around at the DOM for several hours. 在DOM上闲逛了几个小时之后。 It's not easy to unbind an anonymous function, which is what they had done. 解除绑定匿名功能并不容易,这就是他们所做的。 You need to find the event listener, then remove it. 您需要找到事件侦听器,然后删除 This is what ended up working, thanks for the help everyone: 这就是最终的工作,感谢大家的帮助:

getEventListeners(document.querySelectorAll("div.js-calendar-graph")[0]).mouseover[0].remove()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM