Example: Animating scroll with jQuery

A reader asked for an example of using the jQuery scroll code I had written a while back.  Based on that code, here is the example:

<div id="myDiv" style="width: 500px; height: 100px; overflow: auto; border: 1px solid black;"></div>
  <input type="text" id="myTextInput" />
  <input type="button" value="Send" id="postButton" />
<script type="text/javascript">
      $('#myDiv').append($('#myTextInput').val() + '<br/>');
      $("#myDiv").animate({ scrollTop: $("#myDiv").attr("scrollHeight") }, 1000);

A simple, functional example.

Check out the demo: http://demos.kisdigital.com/index.cfm/demos/scroll

Edit 3/10/10:
Please see the new post here:



About Robert Zehnder

Web application developer specializing in ColdFusion/Railo and Open Source development.

Posted on November 14, 2009, in jQuery. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: