SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Anhcors as main menu link question

    I have a client who wants one of the main menu links to be an anchor where it takes them to a certain part of a page which is only 1 page.

    Now obviously, I have used anchor links before but only for like Scroll to the top of the page and never had an issue.


    Goal:
    1) Click on Guarantee menu link
    2) It takes them to the homepage
    3) On the homepage it scrolls them down to where we have the guarantee.
    4) This is a main menu link which is accessed from other pages.

    Thank You!

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Assuming that you have your home page in a file called index.html and that the guarantee has the following at the point where you want to link to (the id that is - the exact tag it is on doesn't matter as long as it isn't inside a table):

    Code:
    <h2 id="guarantee">Guarantee</h2>
    The link to that point from other pages would be:

    Code:
    <a href="index.html#guarantee">guarantee</a>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •