jQuery移动元素在Firefox中高亮显示表格单元格
我有以下代码:jQuery移动元素在Firefox中高亮显示表格单元格,jquery,highlighting,mousedown,Jquery,Highlighting,Mousedown,我有以下代码: // Drag Event var _isMoving = false; $("body").on("mousedown", ".k-event", function () { _isMoving = true; }); // This is here because otherwise the mouse will try and select the grid and looks really ugly $("body").mousemove(function (e
// Drag Event
var _isMoving = false;
$("body").on("mousedown", ".k-event", function () {
_isMoving = true;
});
// This is here because otherwise the mouse will try and select the grid and looks really ugly
$("body").mousemove(function (e) {
if (_isMoving)
e.preventDefault();
});
$("body").mouseup(function () {
_isMoving = false;
});
在Chrome上,这非常有效
然而,在Firefox上,当我按下鼠标按钮移动鼠标时,它仍然希望突出显示表格单元格(就像我试图复制/粘贴某些内容一样)。我如何告诉Firefox不要尝试突出显示任何内容?对于Firefox您还应该防止
鼠标向下
事件:
$("body").on("mousedown", ".k-event", function (e) {
e.preventDefault();
_isMoving = true;
}
$(“body”)。在(“mousedown”,“.k-event”,函数(e){e.preventDefault();_isMoving=true;}上。这就成功了。作为答案发布,我将给予表扬。(OT)P.S.我相信您已经意识到您丢失了
)代码>两次!:)注意并向可能查看代码的新手程序员指出;)修改代码以修复这些错误。接得好,罗科!