2017-02-21 81 views
3

我使用的是angularjs-dragula,我無法自動滾動到從屏幕隱藏的溢出容器。水平滾動問題使用angularjs-dragula

這是我的問題:
我有五個容器在我的dragula和第五個容器隱藏在屏幕上。現在我想從第一個容器中拖出一個元素並將其放入第5個容器中。但我無法做到這一點,因爲屏幕沒有自動滾動到第5個容器。

angularjs-dragula支持垂直滾動嗎?或者是否有我遺失的財產?

例Plunkr:https://plnkr.co/edit/iD38MugmHIx298p7OlrI?p=preview

var app = angular.module('angular-dragula-demo', [angularDragula(angular)]); 
app.controller('MainCtrl', function($scope, dragulaService) { 
    dragulaService.options($scope, 'fifth-bag', { 
     copy: true 
    }); 
}); 

回答

0

好像這個選項不Dragula實現。 Dragula的開發者建議使用模塊dom-autoscroller

在Github上查看此問題:https://github.com/bevacqua/dragula/issues/121

實現與AngularJS此功能:)

1從官方回購下載DOM的自動滾動https://github.com/hollowdoor/dom_autoscroller/blob/master/dist/dom-autoscroller.min.js

2)包括在您的項目文件夾

3)在控制器中啓用自動滾動功能:

// ENABLE AUTOSCROLL FOR GOALS LIST 
var scroll = autoScroll([ 
    document.querySelector('.list') 
], { 
    margin: 30, 
    maxSpeed: 10, 
    scrollWhenOutside: true, 
    autoScroll: function() { 
     //Only scroll when the pointer is down 
     return this.down 
    } 
});