Activity Forums Salesforce® Discussions Need to pin a lightning component so it is always visible on the page

  • Need to pin a lightning component so it is always visible on the page

    Posted by Deepak on August 14, 2019 at 7:48 AM

    have a custom lightning component which have some kind of message embedded. When i add my custom lightning component to a record page and the user is viewing the record page where the custom component is embedded and he is scrolling through the page, i want the message component to be always visible regardless of page scrolling.

    Achintya replied 6 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Achintya

    Member
    August 14, 2019 at 7:53 AM

    You need to use position fixed and set the other attributes like top, right or left, like below:

    <div class=”slds-theme_default” style=”position:fixed;top:7rem;right:2rem;”>
    some help text
    </div>
    You can put this in component and check.

    Using a fixed position will make the element position itself with respect to window port so even while scrolling it will be in the same position.

Log In to reply.