AutoScrolling a DIV tag

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jan 2008
Posts: 2
Reputation: dRoot84 is an unknown quantity at this point 
Solved Threads: 0
dRoot84 dRoot84 is offline Offline
Newbie Poster

Re: AutoScrolling a DIV tag

 
0
  #11
Jan 10th, 2008
Originally Posted by digital-ether View Post
You don't need prototype for something this simple. The post just before this actually had the solution.

You can also do something as simple as:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. div.scrollTop = 10000;

Giving any element a scrollTop of a number larger than its height will scroll it to the bottom. So any large number you know the div height will not exceed will work.
Crystal clear, but this was not what I wanted. Sure you can scroll to the bottom of an Element by just giving it a very large number that sure will be larger than its content height, but what I ment was to scroll to a specific position in the scrollable div, and thats what I showed.

*By accident I found this thread and thought this could be interesting for someone else finding also the thread*
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,085
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: AutoScrolling a DIV tag

 
0
  #12
Jan 10th, 2008
Originally Posted by dRoot84 View Post
Crystal clear, but this was not what I wanted. Sure you can scroll to the bottom of an Element by just giving it a very large number that sure will be larger than its content height, but what I ment was to scroll to a specific position in the scrollable div, and thats what I showed.

*By accident I found this thread and thought this could be interesting for someone else finding also the thread*
Oh I missed your point. Yes, the original post was just on how to scroll to the bottom but yours shows how to scroll to any element in a DIV. Good one.



Offtopic:

Here is how you do it with mooTools. It also allows you to animate the scrolling which can be quite pleasing to look at:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. new Fx.Scroll(Parent, {
  2. wait: false,
  3. duration: 500,
  4. transition: Fx.Transitions.Quad.easeInOut
  5. }).toElement(Child);


Where Parent is the Element the element with the overflow/scrollbars and child is a Child element within the scrolling element.

You could substitute child for: Parent.childNodes[n] where n is the index of the childNode. (IE6 may cough on empty Text Nodes)
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 37429 | Replies: 11
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC