小编zee*_*aiz的帖子

Jquery UI Sortable - Div滚动问题

我在这里创建了一个Demo .

码:

//使用Javascript

$(function() {
    $("#panel").sortable({
        items: ".content",
        axis:"y",
        scroll:true,
    }).disableSelection();

});
Run Code Online (Sandbox Code Playgroud)

// HTML

<ul id="panel" class="scroll">
    <li class="content" style="background-color:red">item1</li>
    <li class="content" style="background-color:green">item2</li>
    <li class="content" style="background-color:blue">item3</li>
    <li class="content" style="background-color:gray">item4</li>
    <li class="content" style="background-color:yellow">item5</li>
    <li class="content" style="background-color:green">item6</li>
    <li class="content" style="background-color:yellow">item7</li>
    <li class="content" style="background-color:red">item8</li>    
</ul>
Run Code Online (Sandbox Code Playgroud)

// CSS

.scroll{
    overflow:scroll;
    border:1px solid red;
    height: 200px;
    width: 150px;
    position:relative;
}
.content{
    height: 50px;
    width: 100%;
}
Run Code Online (Sandbox Code Playgroud)

在那里,当我向下拖动任何框时,它滚动很长并移出其他框.但是,当我向上拖动任何方框时,它可以正常工作.

那么,有什么方法可以防止它长时间向下滚动?

jquery jquery-ui jquery-ui-sortable

4
推荐指数
1
解决办法
6301
查看次数

标签 统计

jquery ×1

jquery-ui ×1

jquery-ui-sortable ×1