1

我在我的网络应用程序中有许多我介绍过的区域$anchorScroll();

实际的功能工作已经预料到,在点击链接时,用户被移动到相应的部分,但是,移动是“跳转”到该部分,而不是平滑滚动。

这是我创建的一个简单的小提琴:http: //jsfiddle.net/oampz/ZRLKC/

我的js:

angular.module('test', []).controller('Ctrl', function ($scope, $location, $anchorScroll) {    

    $scope.scroll = function () {

         $location.hash('section-80');
         $anchorScroll();
    };

});

我正在尝试实现此处的效果(不使用 jquery 或其他库):http ://www.surrealcms.com/blog/smoothly-scroll-to-an-element-without-a-jquery-plugin

4

0 回答 0