更新时间:2022-06-24 07:03:13
您将使用所有可拖动的元素, em>,即为什么当拖放元素时,整个页面会因拖动而滚动。
You'll be using all your draggable elements without any container, i.e. why when you Drag-n-Drop your elements the whole page scrolls due to dragging.
而不是:
<div class="dragWrapper">
<!-- Place all your draggable elements here -->
</div>
设置 max-height
和 dragWrapper 类的c $ c> overflow :
set a max-height
and overflow
of the dragWrapper
class as:
.dragWrapper {
max-height: 400px;
overflow: auto;
}
现在,当您拖放元素,而不是你的 body ,滚动只会在容器内。
Now when you Drag-n-Drop your elements, instead of your body, scroll will be inside the container only.
希望这会为你带来诀窍。 )。
Hope that will do the trick for you(which already did ;).