admin管理员组文章数量:1312811
I have the following problem: In Mozilla Firefox, whenever I hover a dropdown
inside a table, it triggers the mouseleave
event of the table, though the mouse cursor is still inside the table. There is no such problem in Chrome or Edge.
Here is my code with an example data:
DEMO
I have a table and the last row appears when the mouse cursor enters the table. When the mouse leaves - the row hides. The row should hide only if i leave the table
Is there some way or a workaround to prevent the unnecessary mouseleave event to occur?
I have the following problem: In Mozilla Firefox, whenever I hover a dropdown
inside a table, it triggers the mouseleave
event of the table, though the mouse cursor is still inside the table. There is no such problem in Chrome or Edge.
Here is my code with an example data:
DEMO
I have a table and the last row appears when the mouse cursor enters the table. When the mouse leaves - the row hides. The row should hide only if i leave the table
Is there some way or a workaround to prevent the unnecessary mouseleave event to occur?
Share Improve this question asked Oct 19, 2017 at 13:37 zstefanovazstefanova 1,8312 gold badges28 silver badges42 bronze badges2 Answers
Reset to default 9I had the same issue in VueJS and I fixed it like this. First make sure the event object is passed to your method, so use @mouseleave="myEvent"
instead of @mouseleave="myEvent()"
.
myEvent: function(event) {
if (event.relatedTarget === null) {
return;
}
// consider event fired
},
So checking the event.target.nodeName
didn't work for me, I had to use event.relatedTarget
.
You can test for select on mouseleave like this:
$('.testTable').mouseenter(function(e) {
console.log("IN!")
$("#lastRow").show();
}).mouseleave(function(e) {
if (e.target.nodeName.toLowerCase() !== "select") {
console.log("OUT!")
$("#lastRow").hide();
}
});
Fiddle here.
本文标签: javascriptSelect triggers MouseLeave event on parent element in Mozilla FirefoxStack Overflow
版权声明:本文标题:javascript - Select triggers MouseLeave event on parent element in Mozilla Firefox - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741916259a2404751.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论