Activity Forums Salesforce® Discussions How to auto scroll on top of page in Lightning Component in Salesforce using CSS?

  • How to auto scroll on top of page in Lightning Component in Salesforce using CSS?

    Posted by Deepak on February 21, 2020 at 3:03 pm

    How to auto scroll on top of page in Lightning Component in Salesforce using CSS?

    Ayan replied 3 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Ayan

    Member
    January 20, 2021 at 7:57 am

    Check this out.. I have created this and it works perfectly fine for me: https://webcomponents.dev/edit/3vpWJ46hxykfPSACfuNN

  • Ayan

    Member
    January 22, 2021 at 7:54 am

    To make the scrollTop = 0 to work the container div has to have an internal scroll. Which we can get by either giving a height via px or via vh.
    Try that out it should work. I was facing a similar issue while adding LWC inside Flexi Page. The Flexi page has its own scroller but for that, the scrollTop doesn't work. But if we create a separate scroller at the top-level div then the scrollTop starts to work.
    Check this out. I have created this and it works perfectly fine for me: https://webcomponents.dev/edit/3vpWJ46hxykfPSACfuNN

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos