0

I have use scrollTop in angular2. But does not display chrome browser.

document.body.scrollTop = 0;
4
  • Please provide more details Commented Sep 13, 2017 at 6:28
  • Possible duplicate of Scroll Top in angular2 Commented Sep 13, 2017 at 6:29
  • can you please share your code ? also have you added CSS for icon ? also when you define to show your icon ? Commented Sep 13, 2017 at 7:37
  • might help you embed.plnkr.co/kzZ2VR Commented Sep 13, 2017 at 7:41

1 Answer 1

0

Use this code:

 $(window).scrollTop(0);
Sign up to request clarification or add additional context in comments.

4 Comments

As per question icon is not displaying, and in your code when is icon may i know ?
Can you please tell me, have you ever see any icon of scrollTop in your programming career? It is a property
FYI some packages display icon on click of that icon you will move to top of screen, for example in React this package offer same icon react-scroll-up , also i know very well it is property and document.body.scrollTop = 0; is also right one.
and in the question it is clearly mention Does not display scroll top icon ...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.