221
edits
No edit summary |
No edit summary |
||
Line 749: | Line 749: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
var $ | var $element = $('#editpage-specialchars'); | ||
var | var isDragging = false; | ||
var startX, startY, initialX, initialY; | |||
$ | $element.on('mousedown', function(e) { | ||
isDragging = true; | |||
startX = e.clientX; | |||
startY = e.clientY; | |||
initialX = $element.offset().left; | |||
initialY = $element.offset().top; | |||
$element.addClass('dragging'); | |||
}); | |||
if ( | $(document).on('mousemove', function(e) { | ||
$ | if (isDragging) { | ||
} | var dx = e.clientX - startX; | ||
$ | var dy = e.clientY - startY; | ||
$element.css({ | |||
top: initialY + dy + 'px', | |||
left: initialX + dx + 'px' | |||
}); | |||
} | |||
}); | |||
$(document).on('mouseup', function() { | |||
if (isDragging) { | |||
isDragging = false; | |||
$element.removeClass('dragging'); | |||
} | } | ||
}); | }); | ||
}); | }); |