ionic-framework - ionic 降低滚动速度

标签 ionic-framework

尝试通过此代码减慢滚动速度时遇到问题:

$ionicScrollDelegate.$getByHandle('credit').scrollBottom(true). 

我怎样才能减慢滚动速度?因为现在它对我来说滚动得太快了。我需要放慢滚动速度,就像星球大战电影中的信用场景一样。

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();
    };
};

最佳答案

这个问题很老,但有人可能会使用它。

即使没有参数传递选项,您仍然可以使用 $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

我通过 $timeout 结束了通话避免来自 $ionicScrollDelegate 的赛车状况没有被创建。

关于ionic-framework - ionic 降低滚动速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29742525/

相关文章:

javascript - Angular 显示/隐藏仅适用于第二个函数调用,应用/摘要问题?

javascript - $sce.trustAsHtml 和 ng-show

javascript - ionic 2 :Uncaught ReferenceError: require is not defined

angularjs - 使用 ionic 应用程序内的系统浏览器打开所有链接

angularjs - $state.go,页面上缺少元素,直到刷新

javascript - ionic 推送无法读取未定义的属性 'init'

php - 我在 ionic 3 中遇到错误 : Runtime Error Unexpected token < in JSON at position 0 when posting to php from ionic3

ios - XML 错误 : Unquoted attribute value

css - 如何强制 ionic 幻灯片尊重列宽

android - Ionic 4平台添加android错误码ENOLOCAL