Я пытаюсь следовать руководству по перетаскиванию html5 здесь . Мне не удалось зарегистрировать событие dragstart
в элементе rect
. Если я изменю событие с draggable
на mousedown
, оно вызовет обработчик handleDragStart
. Не обращайте внимания на дополнительную пустую регистрацию в коде.
JSFiddle здесь
SVG/HTML 5 Example
loc. js
$(document).ready(function() {
function handleDragStart(e) {
log("handleDragStart");
this.style.opacity = '0.4'; // this ==> e.target is the source node.
};
var registercb = function () {
$("#cvs > rect").each(function() {
$(this).attr('draggable', 'true');
});
$("#cvs > rect").bind('dragstart', handleDragStart);
$(window).mousedown(function (e) {
});
$(window).mousemove(function (e) {
});
$(window).mouseup(function (e) {
log("mouseup");
});
};
function log() {
if (window.console && window.console.log)
window.console.log('[XXX] ' + Array.prototype.join.call(arguments, ' '));
};
registercb();
});