div of edit and drag (click div can edit, delete, drag)

1, can be edited:

<div id="move" contentEditable="true">可编辑</div>

Set contentEditable property lets div programmed editable

2, can drag:

$('#move').draggable();

Using jQuery UI's draggable allows div become draggable, but if the two properties at the same time there will be editing application failure condition.

3, editable, draggable:

<div id="move" contentEditable="true">可编辑</div>

was divTitle = $ ( '# move');

divTitle.draggable () the Click (function ().
{
$ (the this) .draggable ({Disabled: to false});
$ (the this) .css ( 'the backgroundColor', 'transparent');
}). DblClick (function ()
{
$ (the this) .draggable ({Disabled: to true});
$ (the this) .css ( 'the backgroundColor', '# FFFF6F');
});
this allows control what can edit div simultaneously having the properties and drag.

Guess you like

Origin www.cnblogs.com/Annely/p/11489531.html