AngularJS + Safari: Force page to scroll to top when pages switch

后端 未结 9 1913
深忆病人
深忆病人 2021-02-07 00:20

I am having an odd, safari-only scrolling behavior using AngularJS.

Whenever the user flips between pages, the pages are being changed as if they are AJAX. I understand

9条回答
  •  不知归路
    2021-02-07 00:45

    You can use $anchorScroll

    $scope.gotoTop = function (){
      // set the location.hash to the id of
      // the element you wish to scroll to.
      $location.hash('top');
    
      // call $anchorScroll()
      $anchorScroll();
    };
    

提交回复
热议问题