auto scroll to the div down the page

U

usgog

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?
 
S

scripts.contact

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top