auto scroll to the div down the page

Discussion in 'Javascript' started by usgog@yahoo.com, Jun 20, 2007.

  1. Guest

    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?
    , Jun 20, 2007
    #1
    1. Advertising

  2. On Jun 20, 7:06 am, "" <> 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()
    scripts.contact, Jun 20, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sathiamoorthy

    Enable Scroll up and scroll down in CR-report

    Sathiamoorthy, Nov 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    894
    zobalee
    Nov 28, 2006
  2. UJ
    Replies:
    1
    Views:
    568
    John Timney \(MVP\)
    Nov 1, 2006
  3. linkswanted
    Replies:
    1
    Views:
    902
  4. yellowtek
    Replies:
    1
    Views:
    169
    Matt Kruse
    Sep 11, 2006
  5. Martin
    Replies:
    4
    Views:
    331
    Martin
    Feb 18, 2010
Loading...

Share This Page