Home > Web Front-end > JS Tutorial > How to make DIV editable and draggable sample code_javascript skills

How to make DIV editable and draggable sample code_javascript skills

WBOY
Release: 2016-05-16 17:22:10
Original
1048 people have browsed it
1. Editable:

Editable

Setting the contentEditable attribute can make the div programmable Editing status

2. Draggable:

$('#move').draggable();
Use jQuery UI's draggable to make the div change into a draggable state, but if both attributes are applied at the same time, the editable function will be disabled.

3. Editable and draggable:
Copy code The code is as follows:

editable

var divTitle=$('#move');
[code ]
divTitle.draggable().click(function ()
{
$(this).draggable({ disabled: false });
$(this).css('backgroundColor', 'transparent');
}).dblclick(function ()
{
$(this).draggable({ disabled: true }) ;
$(this).css('backgroundColor', '#FFFF6F');
});


By controlling this, you can make the div have edit and drag attributes.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template