User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 375,234 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,978 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 18654 | Replies: 11
Reply
Join Date: Jan 2008
Posts: 2
Reputation: dRoot84 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dRoot84 dRoot84 is offline Offline
Newbie Poster

Re: AutoScrolling a DIV tag

  #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:
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  
Join Date: Sep 2005
Posts: 611
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 38
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Help Re: AutoScrolling a DIV tag

  #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:

new Fx.Scroll(Parent, {
		wait: false,
		duration: 500,
		transition: Fx.Transitions.Quad.easeInOut
	}).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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

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

All times are GMT -4. The time now is 4:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC