1
mousedown後未啓動mouseup。我不知道爲什麼。但如果我取消註釋行mouseup在mousedown後未被觸發
$(this).replaceWith("<div class=" + "'" + $canvas.replace(".", " ") + "'" + "></div>");
然後mouseup正常工作。下面是一段代碼
var onmousemove = function ($canvas) {
// Painting the map with canvas
$map_canvas.mousedown(function() {
var ignoreMouseMove = false;
mouseDownFired = true;
$(".map .row div").mousemove(function (e) {
if (ignoreMouseMove) return;
//$(this).replaceWith("<div class=" + "'" + $canvas.replace(".", " ") + "'" + "></div>");
moveCanvas($canvas, e)
}).mouseup(function() {
ignoreMouseMove = true;
});
});
var paletteClone = $(document).clone(true); // bound handler for .palette div
};
var moveCanvas = function ($canvas, e) {
$(".map ul li." + $canvas).offset({
left: e.pageX - 30,
top: e.pageY - 30
});
};
'.replaceWith'移除'.mouseUp'已被限制的'$(「。map .row div」)''元素。這就是爲什麼'.mouseup'沒有被觸發。 – XeNo13GrIn
請提供一些html代碼 –