邊界限制我有兩個要素:設置爲可拖動對象
1.固定高度的父,overflow:hidden
2.及其孩子,較大的固定的高度。
<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>
我想能夠在父div中上下拖動列表。我正在使用jQuery UI可拖動插件來實現垂直拖動,但我不確定如何限制父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>
我該如何去設置列表位置的垂直上限和下限?
非常非常好的方法,添加一個其他大小的另一個滾動窗格是非常nice.Excellent保羅.. – 2012-07-26 20:20:52