Log in

View Full Version : scrolling div content?



ShootingBlanks
02-01-2008, 07:57 PM
Can someone point me to a tutorial (or if it's easy enough, just show me here) where I can learn how to make a scrolling div? Ideally, one that looks like this (this would be on a black-backgrounded page):

http://www.shootingblanks.net/TEMP/images/divScroller.jpg

Thanks!...

Jas
02-01-2008, 08:13 PM
Do you mean autoscrolling, or scrolling? Scrolling is very easy to do. Set up your div tag's height/width and then add this: overflow="auto". The final product would be something like this:

<div height="100px" width="100px" overflow="auto">YOUR CONTENT HERE</div>
As far at the look you want, I have no Idea how to get it to look like that. (I don't know much about changing the scrollbar).

EDIT: This code is from w3c:

<html>
<head>
<script type="text/javascript">
function setScrollbarColor()
{
document.body.style.scrollbarBaseColor="green";
}
</script>
</head>
<body>

<input type="button" onclick="setScrollbarColor()" value="Set ScrollbarColor" />

<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>

</body>
</html>

So I guess the style would be something like div{scrollbarBaseColor:#123456;} Then just add a background and border and it should be pretty close.

ShootingBlanks
02-01-2008, 08:25 PM
Do you mean autoscrolling, or scrolling? Scrolling is very easy to do.

Cool, yeah - I don't need auto-scroll. Just manual. Thanks!!!

If anyone else can help with the color/scrollbar formatting of the div to look like the pic above, it'd be much appreciated too. Thanks again, Jas!!!

Medyman
02-02-2008, 02:21 AM
Try these on for size:

http://www.hesido.com/web.php?page=customscrollbar
http://www.jools.net/projects/javascript/scrollable-divs/
http://www.java2s.com/Code/JavaScript/GUI-Components/ScrollBar.htm

ShootingBlanks
02-02-2008, 03:12 PM
Try these on for size:

http://www.hesido.com/web.php?page=customscrollbar
http://www.jools.net/projects/javascript/scrollable-divs/
http://www.java2s.com/Code/JavaScript/GUI-Components/ScrollBar.htm

Thanks so much! - I'm sure something like this will be suitable. Thanks! :D