I'm trying to simulate the ScrollIntoView Javascript capability in lightning. I tried to use the ui:scrollerWrapper for the same but it's not working and it's not scrolling up to the ui:scrollWrapper at the top. Any ideas/advise would be appreciated.

<aura:component>
<ui:scrollerWrapper aura:id="scroll" >
    <div>
        This is block 1
    </div>
</ui:scrollerWrapper>
<div class="block1">
    This is block 2
</div>
<div class="block1">
    This is block 3
</div>
<div class="block1">
    This is block 4
</div>
<div class="block1">
    This is block 5
</div>
<lightning:button variant="neutral" label="Scroll up" title="Base action" onclick="{! c.handleClick }"/>

({
handleClick : function(component, event, helper) {

    let s1 = component.find("scroll");
    console.log('s1', s1)
    s1.scrollTo('top');

   }
})
  • according to the docs ui:scrollerWrapper should work only in Salesforce Mobile App - not in desktop – Itai Shmida Dec 10 at 9:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.