angular.js - How to solve the problem that the navigation at the bottom of the page does not scroll to the top of the page after using ui-sref to jump to a new page?
某草草
某草草 2017-05-15 17:13:50
0
3
622

How to solve the problem that the navigation at the bottom of the page does not scroll to the top of the page after using ui-sref to jump to a new page?

某草草
某草草

reply all(3)
漂亮男人

Hello, I also encountered this problem. My previous page scrolled to the bottom, but when I jumped to the new routing page, it was still at the bottom. How do I start from the top

phpcn_u1582
<ui-view autoscroll/>
为情所困
app.run(['$window', '$rootScope', '$location' ,'$cookieStore', '$state', 'CacheManager',  '$timeout', function($window, $rootScope, $location, $cookieStore, $state,CacheManager, $timeout){


$rootScope.$on('$viewContentLoaded', function(){

var interval = setInterval(function(){
  if (document.readyState == "complete") {
      window.scrollTo(0, 0);
      clearInterval(interval);
  }
},200);

});



}]);

This method can be implemented, but I don’t know if it is good for performance

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template