【发布时间】:2016-07-06 10:23:01
【问题描述】:
这是我想要做的: https://gfycat.com/ValidEmbarrassedHochstettersfrog
我想使用鼠标突出显示<table> 中的一些<td> 对象。该视频录制在 Chrome 上,可以完美运行。不幸的是,它不在 Firefox 上。
这是它的工作原理:
- 用户点击表格中的第一个单元格
- 他将鼠标拖到其他单元格
- 单元格被突出显示
代码:
$("#productList").on("mousedown", "td", function () {
//save from where to start
}
$("#productList").on("mouseover mouseenter mouseover hover", "td", function () {
//update highlighting, modify classes
//this function isn't fired when I click on one of <td> and drag mouse somewhere else
}
#productList 是 <table>。
虽然在 Chrome 中一切正常,但 firefox 似乎不会触发 mouseenter 事件(以及我尝试过的任何其他事件)。鼠标悬停仅适用于我单击的对象。当我使用鼠标拖动时,Firefox 似乎只考虑焦点对象。
如何绕过它?
编辑:
需要提及的一件重要事情:我在每个单元格中都有一个<input>。这可能会导致问题
https://jsfiddle.net/q8v7f6uv/6/
【问题讨论】:
标签: javascript jquery firefox