I have two elements:
1. Parent of fixed height, overflow:hidden
2. Its child element with a larger fixed height.
<style type="text/css"> .myList {list-style:none; margin:0px; padding:1px;} .myList li{ height:50px; margin:4px; padding:2px;} .dragPanel {height:230px; border:solid; overflow:hidden;} </style> <div class="dragPanel"> <ul class="myList"> <li>1</li> <li>2</li> ... .... <li>8</li> <li>9</li> </ul> </div>
I want to be able to drag the list up and down in the parent div. I am using the jquery ui draggable plugin to achieve vertical drag and drop, but I'm not sure how to limit the list in the parent div.
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.draggable.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.dragPanel').addClass("hover"); $('.myList').draggable({ axis: 'y' }); }); </script>
How can I set the upper and lower limits of the vertices for the position of the list?
javascript jquery jquery-ui draggable
Paul
source share