在使用angularjs获得ajax调用响应后,我想滚动到页面顶部.基本上,我在页面顶部显示alert 消息,我希望在收到ajax响应时关注alert 消息.
谢谢
在使用angularjs获得ajax调用响应后,我想滚动到页面顶部.基本上,我在页面顶部显示alert 消息,我希望在收到ajax响应时关注alert 消息.
谢谢
你可以用
$window.scrollTo(x, y);
where x
is the pixel along the horizontal axis and y
is the pixel along the vertical axis.
Scroll to top
$window.scrollTo(0, 0);
Focus on element个
$window.scrollTo(0, angular.element('put here your element').offsetTop);
Update:
Also you can use $anchorScroll