Setting boundary limits for a draggable object

前端 未结 4 443
借酒劲吻你
借酒劲吻你 2020-12-31 18:53

I have two elements:

1. A parent of fixed height, overflow:hidden

2. Its child, of larger fixed height.

4条回答
  •  有刺的猬
    2020-12-31 19:27

    You don't have to drag anything for that kind of structure. What you need is to set up the parent div with overflow-x:hidden; and overflow-y:scroll;. That way, its content will be scrollable.

    If you want to hide the scrollbar, just put this property: .dragPanel::-webkit-scrollbar{width:0 !important} and that's it! I don't really know why you were thinking of dragging elements instead of just scrolling the content (which is the correct way to carry out this kind of "problems"). Anyways, I hope it helps anybody who needs to fit the same necesity. Greetings!

提交回复
热议问题