Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > auto scroll to the div down the page

Reply
Thread Tools

auto scroll to the div down the page

 
 
usgog@yahoo.com
Guest
Posts: n/a
 
      06-20-2007
I have a div close to the bottom of the HTML page, and it is not
displayed by default. I also have a link to toggle this div at the top
of the page. So after I click the link, the div will show up. But
because the position of div in low on the page, users have to scroll
down the page to see the div. Otherwise, it is not visible directly.
So I am wondering how can I set focus to div directly so after
clicking the link, the page will automatically scroll down to the div?

 
Reply With Quote
 
 
 
 
scripts.contact
Guest
Posts: n/a
 
      06-20-2007
On Jun 20, 7:06 am, "(E-Mail Removed)" <(E-Mail Removed)> wrote:
> I have a div close to the bottom of the HTML page, and it is not
> displayed by default. I also have a link to toggle this div at the top
> of the page. So after I click the link, the div will show up. But
> because the position of div in low on the page, users have to scroll
> down the page to see the div. Otherwise, it is not visible directly.
> So I am wondering how can I set focus to div directly so after
> clicking the link, the page will automatically scroll down to the div?


Add
<a name="div"></a> before the div and use
<a href="#div">Go to DIv</a> to focus it.

Example

<a href="#div">Go to div</a>

some content. ... . . .


<a name="div"></a>
<div>
content...


</div>



-----------
OR you can use scrollIntoView method:
DIVElement.scrollIntoView()

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force a scroll of div with overflow set to auto? Martin Javascript 4 02-18-2010 07:45 PM
Functionality to scroll into view? (autoamtically scroll to contentsin the bottom right corner of a large web page) crazychrisy54@hotmail.com Javascript 0 12-19-2007 02:09 PM
Enable Scroll up and scroll down in CR-report Sathiamoorthy ASP .Net 1 11-28-2006 11:42 PM
Using a div with scroll bars - can we get the scroll bars on the left instead of the right side? UJ ASP .Net 1 11-01-2006 09:32 PM
Monitoring of a vertical scroll within a <div style='overflow: auto height:300px;'> yellowtek Javascript 1 09-11-2006 07:29 PM



Advertisments