我试图减慢此代码的滚动时遇到问题:
$ionicScrollDelegate.$getByHandle('credit').scrollBottom(true).
Run Code Online (Sandbox Code Playgroud)
如何减慢滚动速度?因为现在滚动速度太快了.我需要放慢滚动速度,就像星球大战电影中的信用场景一样.
非常感谢Anyhelp,谢谢!
$scope.viewCreditsV2 = function () {
$ionicModal.fromTemplateUrl('views/popupcredit.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
$scope.modal.show();
if ($scope.modal.isShown()){
setTimeout(function() {
// Do something after 2 seconds
$ionicScrollDelegate.$getByHandle('credit').scrollBottom(true);
}, 2000);
}
});
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
// $scope.modal.hide();
$scope.modal.remove();
};
};
Run Code Online (Sandbox Code Playgroud)
Edu*_*net 11
这个问题很老,但有人可能会使用它.
即使没有参数传递选项,您仍然可以使用$ionScrollDelegate.来访问ScrollView对象.
按照@Jeremy Wilken的回答(帮助我推导出这个),你可以做到:
$timeout(function() {
$ionicScrollDelegate.getScrollView().options.animationDuration = 400;
console.log($ionicScrollDelegate.getScrollView().options);
});
//.....
$ionicScrollDelegate.scrollBy(0,20, true) // Animation will be slower now
Run Code Online (Sandbox Code Playgroud)
我把呼叫包裹在一起,$timeout以避免因为$ionicScrollDelegate没有创建赛车条件.