Results 1 to 7 of 7

Thread: Jump to the content

  1. #1
    Join Date
    Jul 2006
    Posts
    142
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Jump to the content

    Hey guys! I was just wondering if there is a jscript code to jump to the middle (or where my content is) of the page if i click on the link on the same page. if not how would you do it anyways?

  2. #2
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    use <a href="#name">click here</a>

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    To elaborate, what you want is a link anchor. Right beside the content you want users to jump to when a link is clicked on the same page, add an anchor:

    Code:
    <a name="#gohere"></a><p>My middle content here</p>
    Then, anywhere on your page, create a link that takes the user to the above when clicked on by doing:

    Code:
    <a href="#gohere">Jump to content</a>

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I thought that one needed the # and the other didn't.
    Isn't it:
    <a name="anchor">
    <a href="#anchor">?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Yes djr33 is correct

    Code:
    <a name="gohere"></a><p>My middle content here</p>
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    <a href="#gohere">Jump to content</a>

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Though, I'm not sure, and maybe both are correct.
    I'm assuming someone will be able to clear it up soon.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah yes technically the anchor itself shouldn't have the "#" prefix, though it seems with it doesn't change the behavior.

Bookmarks

Posting Permissions

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