Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery移动元素在Firefox中高亮显示表格单元格_Jquery_Highlighting_Mousedown - Fatal编程技术网

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.我相信您已经意识到您丢失了
两次!:)注意并向可能查看代码的新手程序员指出;)修改代码以修复这些错误。接得好,罗科!