Home  >  Q&A  >  body text

angular.js - angular从列表页到详情页的滚动条位置怎么改变为 0,angular可有内置方法?

angular构建的项目,从商品列表(比如 scroolTop = 400)转到商品详情(scrollTop还是 400),滚动条位置不能到最顶部,而是保持在列表页之前的的位置,怎么让转到新内容页的时候 scrollTop = 0,请教........

PHP中文网PHP中文网2691 days ago492

reply all(3)I'll reply

  • 世界只因有你

    世界只因有你2017-05-15 17:08:35

    Set document.body.scrollTop=0 directly after the jump.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:08:35

    Angular is born to control the DOM of the page~, so there is nothing wrong with directly setting the value of scrollTop when you write it.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:08:35

    Thank you everyone

    But I don’t know if there is Angular’s ​​own processing method. I would like to add that the monitoring route is processed uniformly, as shown in the picture above

    reply
    0
  • Cancelreply