angular.js - 页面底部的导航用 ui-sref 跳转新的页面后,不滚动到页面顶部的问题这么解决?
某草草
某草草 2017-05-15 17:13:50
0
3
540

页面底部的导航用 ui-sref 跳转新的页面后,不滚动到页面顶部的问题这么解决?

某草草
某草草

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!