首页 > 其他 > 详细

ui-router中的锚点问题(angular中的锚点问题)

时间:2016-12-16 09:55:51      阅读:187      评论:0      收藏:0      [点我收藏+]
angular.module(‘anchorScrollExample‘, [])
.controller(‘ScrollController‘, [‘$scope‘, ‘$location‘, ‘$anchorScroll‘,
  function($scope, $location, $anchorScroll) {
    $scope.gotoBottom = function() {
      // set the location.hash to the id of
      // the element you wish to scroll to.
      $location.hash(‘bottom‘);

      // call $anchorScroll()
      $anchorScroll();
    };
  }]);


官网文档传送门:https://docs.angularjs.org/api/ng/service/$anchorScroll
综上,angular对锚点做了处理,使用时先用$location.hash(),指定位置,hash的参数就是锚点id,然后再使用$anchorScroll()移动到锚点;

ui-router中的锚点问题(angular中的锚点问题)

原文:http://www.cnblogs.com/ftqh/p/6185626.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!