Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone
Accepted Solution

code to set a vertical scroll bar for a div element

Hi........

        I'm looking for the code for a vertical scrollbar. I researched various documents and implemented with CSS overflow : auto .  It doesn't work and searching again i stucked with webkit-scrollbar in Github, it is working fine with the whole body and not with div element...........      Anybody have a code or any guide where to find the code.

 

        

Please use plain text.
Contributor
kranthi4one
Posts: 31
Registered: ‎10-03-2011
My Device: 9900
My Carrier: developer

Re: code to set a vertical scroll bar for a div element

hi,


<div style="border:1px solid black;width:200px;height:100px;overflow:scroll;overflow-y:scroll;overflow-x:hidden;">
<p style="height:250%;">
By using overflow-y, we can create scroll bars when the contents of this div are bigger/higher than the container. Also, by setting this paragraph to 250 percent, it is automatically 250 percent higher than the parent container - forcing an overflow.
</p>
</div>
<p style="font-size:10px;"><a href="http://www.quackit.com/html/codes/">HTML code</a></p>


Please use plain text.
Developer
d_source
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: code to set a vertical scroll bar for a div element

I had a scroll bar issue and this solved it: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Force-scrollbars-on-Playbook-app...

 

Does this help you?

Please use plain text.
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Re: code to set a vertical scroll bar for a div element

Hi source,

                I checked that before, but i can include scroll to the body and not to div. Did you used for div  then please post the code here.............

Please use plain text.
Developer
d_source
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: code to set a vertical scroll bar for a div element

Just by adding the scrollbar code to the css the page automatically adds it where/when ever needed. I didn't attach it to any particular element.


::-webkit-scrollbar {
    width: 15px;
}

 

Many style options available: http://css-tricks.com/9130-custom-scrollbars-in-webkit/

Please use plain text.
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Re: code to set a vertical scroll bar for a div element

Hi source........

                  Thank you for your help. It worked. I copied the code from http://css-tricks.com/examples/WebKitScrollbars/ and then added an overflow:auto to my div element.

Please use plain text.