Setting boundary limits for a draggable object

前端 未结 4 462
借酒劲吻你
借酒劲吻你 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:37

    Ok,

    Here is the route I have gone down...

    When the page is loaded, I add a container div around the draggable list. I set it's height to twice that of the list, then position it up the page a little:

    
    

    The list is then contained to this new element.

    This appears to do the job, but the positioning is all a little shakey if the list has any padding / margin applied. Any thoughts on that would be appreicated!

    ------Edit ---------

    Ok, I think I have solved the placement issue. I have turned this into a plugin so other people don't have to spend time creating this functionality.

    jQuery Drag-gable List at Github

提交回复
热议问题