下面的代码有什么问题?拖放jQuery
在这里看到:http://jsfiddle.net/xKcAu/
JS:
$(document).ready(function() {
$('#diag1').draggable();
$('#diag1').css('background-color', '#f4f');
$('#diag1').width('100px');
$('#diag1').height('50px');
$('#cnt1').css('background-color', '#4ff');
$('#cnt1').width('300px');
$('#cnt1').height('300px');
$('#cnt1').droppable({
drop: function(event, ui) {
$(this).append(ui.draggable);
}
});
});
HTML:
<div id="cnt1">ddd</div>
<div id="diag1">Dialog 1</div>
如果我滴在一个大的小格也隐藏了。为什么?
看起来像一个'z-index'问题。 – Bot 2012-03-01 16:50:15
这一行:$(this).append(ui.draggable); ---也看看jQuery中的链接,你不需要一直定义jquery函数的选择器。你可以做$('。selector')。css()。parent()。find()。whatever() – ggzone 2012-03-01 16:50:32
http://jsfiddle.net/xKcAu/4/ – 2012-03-01 16:52:34