how to make scrollable DIV just like facebook ticker. i want to make scrollable DIV but i don't know how to make it. i searched question but i did not got it right

link|improve this question

facebook ticker ? can you show image please ?? – Pranay Rana Apr 24 at 6:25
1  
Check my answer edited by me will help you to achieve what you want easily...do accept answer if it works for you.... – Pranay Rana Apr 24 at 6:40
feedback

5 Answers

up vote 2 down vote accepted

Edit :

jQuery plugin for this type of scrolling : jScrollPane - cross browser styleable scrollbars with jQuery and CSS

Org:

just set style="overflow:auto" will do for you

<div style="overflow:auto;width:100px;height:100px;" > content </div>

you need to set height and width of div as given above

link|improve this answer
please read explanation of my question i want to make scrollable DIV like Facebook ticker – Web Addicted Apr 24 at 6:25
@user1331534 - check the edited answer ........... – Pranay Rana Apr 24 at 6:48
feedback

The basic approach to making a div scrollable is to limit its width and height to something smaller than is required by its content, and to apply overflow: auto.

If you want to build a custom implementation, such as Facebook has, you would instead set overflow: hidden so that the div sticks to its width and height, and simply hides anything that does not fit, and build your own controls to move the content up and down.

The custom scrollbar that facebook has implemented uses a combination of several javascript and CSS features:

  • The scrollbar is shown/hidden based on mouse hover
  • Scrollbar size is adjusted according to length of content
  • Scrollbar is draggable
  • Dragging scrollbar moves the content within the div
  • The script manually listens to the scroll wheel to invoke custom scrolling

The purpose of Stack Overflow is not for us to build your entire component. If there is any single feature listed above that you cannot work out how to build, you should ask a question about that, and point out what you've tried.

link|improve this answer
i know this but i am talking about to make something like facebook.I need custom custom scrollbar . See explanation in my question – Web Addicted Apr 24 at 6:23
feedback
<div class="scrollingDiv">Test</div>  

and your script:

 div.scrollingDiv {    overflow:scroll; } 
link|improve this answer
please read explanation of my question i want to make scrollable DIV like Facebook ticker – Web Addicted Apr 24 at 6:24
feedback

Try iScroll. It supports both mobile devices and the browsers.

link|improve this answer
do you know how to implement this manually? – Web Addicted Apr 24 at 6:34
What do you mean? The implementation is quite straight-forward. Eg: var myDiv = document.getElementById('myDiv'), myScroll = new iScroll(myDiv); – zvona Apr 24 at 6:38
It is quite simple.. Just try this JSFiddle: jsfiddle.net/4JtKp/10 – Chinmaya003 Apr 24 at 7:00
feedback

Facebook (and Google Reader) use custom scrollbar styling which is available as a non-standard part of CSS. Check out http://www.webkit.org/blog/363/styling-scrollbars/ for implementation details.

It's worth noting that you will still need to have the overflow set to either auto or scroll for users that are in browsers that don't support the custom scroll bars.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

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