我一直在使用 $anchorScroll 从页面顶部跳转到底部,如下所示:
app.controller('homeCntl',
function($scope, $location, $anchorScroll){
$scope.goToBottom = function() {
$location.hash('bottomOfPage');
$anchorScroll();
}
});
效果很好,它会跳转到页面底部。
虽然它看起来不太好,我想知道是否有办法为此添加动画/过渡效果?
或者如果我只需要考虑另一种方法,例如制定指令或使用 jquery。
谢谢。
最佳答案
不,ngAnimate
不支持 $anchorScroll
。 $anchorScroll 本身也不公开任何用于构建动画的 API。
关于angularjs - 我可以为 $anchorScroll 设置动画吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21097130/