如果在mcustomscrollbar中拖动元素,则不会向下滚动

vai*_*lar 5 html javascript

我在Scrollbar(mcustomscrollbar)中有很少的可拖动元素.如果我尝试将此元素拖动到滚动条可见区域下方的可放置区域,则滚动不会自动向下移动.

请建议如何实现这一目标.

Pic*_*ard 0

就我而言,我使用mCustomScrollbarwith jquery-sortable( https://johnny.github.io/jquery-sortable/ ) - 我需要一种方法来移动滚动条内容,同时拖动可排序元素以获取隐藏在下面的内容。

我使用onDragjquery-sortable 事件来移动滚动条,mCustomScrollbar scrollTo方法如下:

        onDrag: function ($item, position) {
            // original functionality - better be safe
            $item.css(position);

            var sign = '-';
            if ($this._prevDragPositionY > position.top) {
                sign = '+'; //console.log('scrolling up');
            } else { //console.log('scrolling down'); }
            $this._prevDragPositionY = position.top;

            $('.jsScroll').mCustomScrollbar("scrollTo", sign + "=75", {
                scrollInertia: 300,
                scrollEasing: "linear"
            });
Run Code Online (Sandbox Code Playgroud)

我希望这有帮助 :)