You should be able to do this by changing the div's .scrollTop value via
javascript (maybe just pick a very large number to ensure bottom is hit,
like 10,000).



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jeremy Kitchen
Sent: Wednesday, March 08, 2006 2:21 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] question about auto-updating div
withoverflow:auto and maintaining position

I have a div (with overflow:auto) that gets stuff added to it via 
Ajax.PeriodicalUpdater, and I'd like to keep it scrolled to the bottom
all 
the time, unless the user manually scrolls away from the bottom (and be
able 
to return it to its bottom-sticky form afterwards)

I'm not sure if this is just some css trickery I need to do, or if it
requires 
some javascript to do it.

Here's what I have so far (yes, I'm creating an online chat interface)
http://edge.scriptkitchen.com:81/~kitchen/chat.html

I tried putting a <a name="bottom" id="bottom" /> at the bottom of the
div, 
and an oncomplete with effect.scrollto('bottom') but that didn't do
anything, 
presumably because effect.scrollto is checking the scroll position of
the 
overall window (which should theoretically never scroll) rather than the

scroll position of the div itself.

Any help would be greatly appreciated :)

Thanks!

-Jeremy

-- 
Jeremy Kitchen ++ [EMAIL PROTECTED]

In the beginning was The Word and The Word was Content-type: text/plain
  -- The Word of Bob.

The information transmitted in this electronic mail is intended only for the
person or entity to which it is addressed and may contain confidential,
proprietary, and/or privileged material.  Any review, retransmission, 
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from all computers.

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to