www.webdeveloper.com
Results 1 to 3 of 3

Thread: Scroll To help! confused..

  1. #1
    Join Date
    Mar 2012
    Posts
    21

    Scroll To help! confused..

    Hi all!

    I have a little problem. I am making a basic website and I wanted a scrollto function but I have no idea how to start.

    I wanted that if you click on a link say for example "25th May" it would go to a different page where the text is but scroll or jump to that section.

    Does anyone have any ideas of how to go about this?



    Thanks in advance!

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,648
    you have to put the proper anchor in the next page markup - something like this:

    HTML Code:
    <a name="25_may"></a>
    <p>bla-bla-bla</p>
    and then add the name of this anchor as a part of url in the href attribute of the link on you first page:

    HTML Code:
    <a href="nextpage.htm#25_may">25th May</a>
    the part aftrer the # sign is called 'hash'.
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

  3. #3
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,456
    Hi there jamesy23,

    you do not need javascript to achieve this.

    Give an id - ( let's say id="may25" ) to an element, it does not necessarily have to be the a element,
    to which you wish to scroll, then use this code...
    Code:
    <a href="the-new-page.html#may25">25th. May</a>
    
    coothead
    Last edited by coothead; 05-13-2012 at 01:45 PM. Reason: spelling error

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles