我正在使用angularjs-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
});
});
Run Code Online (Sandbox Code Playgroud)
看来这个选项在 Dragula 中没有实现。Dragula 的开发人员建议使用模块dom-autoscroller。
在 Github 上查看此问题:https ://github.com/bevacqua/dragula/issues/121
要使用 AngularJS 实现此功能:
1)从官方仓库下载dom-autoscroller : 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
}
});
Run Code Online (Sandbox Code Playgroud)