How can I have an element with “overflow-y: auto” but still allow the browser to scroll when i drag an item horizontally using jquery ui sortable?

你。 提交于 2019-12-08 05:06:32
JSuar

Using the helper function seems to solve the horizontal scroll issue.

$(function () {
    $(".connectedSortable").sortable({
        connectWith: ".connectedSortable",
        start: function (event, ui) {
             $('body').scrollParent();
        },
        helper: function (e, tr) {

                var $helper = tr.clone();

                 $('#board').append('<div id="clone" style="padding:4px 3px;border:1px solid #DBDBDB;background-color:rgb(223, 240, 249)">' + $helper.html() + '</div>');
                 $("#clone").hide();
                 setTimeout(function () {
                     $('#clone').appendTo('body');
                     $("#clone").show();
                 }, 1);
                 return $("#clone");

        }
    }).disableSelection();
});

Work Example: http://jsfiddle.net/9kFu8/3/

via jQueryUI sortable and draggable target won't scroll horizontally for drop but will for sort

I made a fiddle with your code and it recreates the problem for me. http://jsfiddle.net/52gaw/

Here is the fiddle with just one line removed. http://jsfiddle.net/52gaw/1/

.swimTableTbody {
    display: block;
    overflow: auto;   // remove this line
    width: 100%;
}

The issue is caused by the overflow: auto; line. Just remove it and it works like you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!