我需要帮助才能使用jquery ui使引导面板掉落并拖动。我想知道是否有人会帮助我。
代码:
For Each line In RichTextBox1.Lines
e.Graphics.DrawString(line, font, Brushes.Black, x, y)
y += e.Graphics.MeasureString(line, font).Height
Next
HTML类:
$( ".draggable" ).draggable({revert: true, snap: 'inner'});
$( ".droppable" ).droppable({
drop: function( event, ui ) {
var one = $(this).html();
var two = ui.draggable.html();
$(this).html(two);
ui.draggable.html(one);
}
});
答案 0 :(得分:1)
像这样创建两个div:
<div class="draggable">Draggable</div>
<div class="droppable">Droppable</div>
...的jQuery
$( ".draggable" ).draggable({revert: true, snap: 'inner'});
$( ".droppable" ).droppable({
drop: function( event, ui ) {
var one = $(this).html();
var two = ui.draggable.html();
$(this).html(two);
ui.draggable.html(one);
$( ".droppable" ).css('background-color','yellow');
$( ".draggable" ).css('background-color','pink');
}
});
以下是jsbin的实时预览: https://output.jsbin.com/sericabara