Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 01-07-2009
Member
 
Join Date: May 2008
Posts: 248
Using scroll for div element

Hello friends,

I am stuck with the scroll for div element.
I want to use a scroll to go at a particular element & I have the id.

I want some info on using window.scrollTo() function.

If you guys can help me out It will be great help.
Reply With Quote
  #2  
Old 01-07-2009
Member
 
Join Date: Aug 2008
Posts: 281
Re: Using scroll for div element

check out a javascript library, like jquery or mootools.
Reply With Quote
  #3  
Old 01-07-2009
Member
 
Join Date: Apr 2008
Posts: 264
Re: Using scroll for div element

I think horizontal scroll are not bad. Such website look very nice.
Try this:

Code:
<div style="HEIGHT: 500px; WIDTH: 100%; OVERFLOW: scroll;">
I hope this helps.
Reply With Quote
  #4  
Old 01-07-2009
Member
 
Join Date: Oct 2008
Posts: 116
Re: Using scroll for div element

When your button clicked and an item selected call this selected item's focus() method. this will cause auto scroll to your element :

Code:
<div style="height:80px; overflow:auto;">
    <input type="text" id="id1"><br><br>
    <input type="text" id="id2"><br><br>
    <input type="text" id="id3"><br><br>
    <input type="text" id="id4"><br><br>
    <input type="text" id="id5"><br><br>
    <input type="text" id="id6"><br><br>
</div>
<input type="button" onclick="document.getElementById('id6').focus();">
OR

when you want to scroll to a particular item, execute the following JavaScript code:

Code:
location.hash = itemID;
...where itemID is a variable that contains the ID of the element you want to scroll to.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Using scroll for div element"
Thread Thread Starter Forum Replies Last Post
Can't open word document "the name in the end tag of the element must match the element type in the start tag." Zerinos Windows Software 1 10-05-2012 11:55 AM
Unable to modify the parent container element before the child element is closed Flicker Software Development 5 18-06-2011 07:39 AM
Why does firefox scroll through images when im trying to scroll the page??? shenny88 Technology & Internet 3 25-11-2010 08:18 AM
What is an XML Element? Solitario Software Development 4 29-01-2010 06:38 PM
Code to scroll to javascript element. sizzla Software Development 2 04-07-2009 10:13 PM


All times are GMT +5.5. The time now is 10:59 AM.