jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Jquery UI Sortable – Div滚动问题大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建了一个Demo here.

码:

//使用Javascript

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

});

// 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>

// CSS

.scroll{
    overflow:scroll;
    border:1px solid red;
    height: 200px;
    width: 150px;
    position:relative;
}
.content{
    height: 50px;
    width: 100%;
}

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

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

解决方法

像这样更改样式表:

.scroll {
    border: 1px solid red;
    height: 200px;
    overflow: auto;
    position: static;
    width: 150px;
}

并使用此代码的ul上部:

<div style="overflow:hidden;width:150px;height:200px;position:relative">

大佬总结

以上是大佬教程为你收集整理的Jquery UI Sortable – Div滚动问题全部内容,希望文章能够帮你解决Jquery UI Sortable – Div滚动问题所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。