Forum Moderators: open
i've made a small chat. I want to scroll to the bottom, but i dont know how, i've tried more than 1 ways, but had most succes with jquery, but this only resulted into scrolling down to 20% of the page....
<script type="text/javascript">
$('#mainSpace').animate({scrollTop: $('#mainSpace')[0].scrollHeight});
</script>
also tried: <snipped url> but it didnt work for me.
my html page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-language" content="en">
<meta name="description" content="">
<meta name="keywords" content="">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script>
<title>Untitled</title>
<link rel="stylesheet" type="text/css" href="css/chat_css.css">
</head>
<body>
<div id=container>
<div id=header></div>
<div id=mainSpace>// A lot of text to make sure the div had to scroll.</div>
<div id=rightNav></div>
<div id=footer></div>
</div>
<script type="text/javascript">
$('#mainSpace').animate({scrollTop: $('#mainSpace')[0].scrollHeight});
</script>
</body>
</html>
css for the scrollable div:
#mainSpace{
float: left;
margin-left: 5px;
width: 279px;
height: 241px;
background-color: #638eb7;
border: 1px #000000 solid;
overflow: auto;
}
I really hope somebody is able to help me...
greetings.
[edited by: whoisgregg at 4:35 pm (utc) on Aug. 18, 2009]
[edit reason] Whoops, no URLs please. See TOS [webmasterworld.com] :) [/edit]