无法使用滚动条将子元素从一个div拖到另一个div [英] unable to drag child elements from one div with scroll bar to another
本文介绍了无法使用滚动条将子元素从一个div拖到另一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将元素从一个div拖动到另一个div,其中源div已启用滚动条。当我尝试从源div中拖动我的元素时,div会使用水平滚动条进行扩展,而我无法将元素拖出div但是当滚动没有启用它工作正常。
下面是我的代码。
< div id = source class = box < span class =code-attribute> style = 溢出:滚动 >
< div class = dragme > bacon < / div >
< / div >
< div id = drop class = box >
< / div >
$(' .dragme')。draggable();
$(' #drop,#source')。droppable({
drop: function (e,ui){
$(e.target).append($(ui.draggable).detach()。css({ ' top':' ',' left':' '}));
}
});
解决方案
(' .dragme')。 draggable();
(' #drop,#source')。droppable({
drop: function (e,ui){
(e.target)。附加(
I want to drag elements from one div to another where source div has scrollbar's enabled.When i try to drag my elements from source div the div expands with horizontal scroll bar and i am unable to drag element out of the div however when the scroll is not enabled it works fine.
Below is my code.
<div id="source" class="box" style="overflow:scroll">
<div class="dragme">bacon</div>
</div>
<div id="drop" class="box">
</div>
$('.dragme').draggable();
$('#drop, #source').droppable({
drop:function(e, ui) {
$(e.target).append($(ui.draggable).detach().css({'top':'', 'left':''}));
}
});
解决方案
('.dragme').draggable();
('#drop, #source').droppable({ drop:function(e, ui) {
(e.target).append(
这篇关于无法使用滚动条将子元素从一个div拖到另一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文