1

I am not able to get the default scroll bar working for a div inside Lightning Component in devices. The default scroll bar is coming but when I try to scroll it in devices the page is getting scrolled instead of that div. I have added the class 'slds-scrollable--y' for getting the default scroll bar.

0

You can use newly added Lightning component in the Winter '17, ui:scrollerWrapper that enables native scrolling in Lightning Components Salesforce1 app as well as in Lightning Desktop.

A ui:scrollerWrapper creates a container that enables native scrolling in Salesforce1. This component enables you to nest more than one scroller inside the container. Use the class attribute to define the height and width of the container.

Please find the code below:

Component:-

<aura:component implements="force:appHostable, flexipage:availableForAllPageTypes">
    <div class="mainWrap">
        <ui:scrollerWrapper class="sWrapTest">
            <ul class="testDiv">        
               <li>In the Winter ’17 release, many of your favorite features 
                   are easier to use than ever before. 
               </li>
               <li>Lightning Experience has a brand new                      
                   navigation bar and lots of critical sales,
                   service, and analytics capabilities. 
               </li>
               <li>You’ve got more options for managing customer and partner
                   communities, running your business from your phone, 
                   and keeping your data and your users secure. 
               </li>
               <li>Not to mention plentiful new
                   customization and app development features, 
                   including custom Lightning apps.
               </li>                      
               <li>Other features require direct action by an administrator 
                   before users can benefit from the new functionality.
               </li>
               <li>If a key feature is also available in Salesforce1, 
                   our mobile app, we mention that in the feature description. 
               </li>
               <li>ui:scrollerWrapper
                   Creates a container that enables native scrolling in 
                   Salesforce1.
               </li>

            </ul>
        </ui:scrollerWrapper>
    </div>
</aura:component>

Style:-

.THIS .sWrapTest {
    height:100px;
    width:100px;
}
-2
<style type="text/css">
        ::-webkit-scrollbar { width: 6px; height: 8px; } ::-webkit-scrollbar-            track-piece { background-color: #a8b7c7; border-radius:20px; } ::-webkit-scrollbar-thumb:vertical { height: 30px; background-color: #e0e5ee; border-radius:20px; }

</style>
  • Can you please help me find out what this code snippet does with the functionality? – Pintu Francis Jul 13 '16 at 11:51
  • use this code in between style tag <style> then paste this code and close style tag – Vipin Indora Jul 13 '16 at 11:59
  • @VipinIndora This is only changing the default SLDS CSS styling. The scroll still doesn't work. There's a known issue here success.salesforce.com/issues_view?id=a1p30000000ePVNAA2 – SE_User Jul 13 '16 at 12:29
  • @VipinIndora There is no <style> tag in Lightning Component Framework and this issue is specific to Lightning Component Framework. Please refer the framework and respond. – Pintu Francis Jul 14 '16 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.