SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jul 2009
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linking directly to javascript function in an A HREF link?

    Please click the link below.

    http://www.cioppinoofpittsburgh.com/menus

    You will notice the different options for the menu in the left sidebar. I will need to link directly to some of these pages from an outside site. It this possible?

    post.jpg

    Thanks!

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You should be able to do that, but you'll have to probably change the way things work a little bit.

    Firstly, it's probably a good idea to give each of your menu sections an ID, so you can uniquely identify them. (For example, the <div class="col"> that contains the starters menu might be <div id="starters" class="col">)

    Then, a link to a specific menu page may look like:

    http://www.cioppinoofpittsburgh.com/menus#starters
    or
    http://www.cioppinoofpittsburgh.com/menus#sides

    Then you can check the URL's hash when the page loads and see if it matches one of your IDs, if it does, you can move to the correct menu page.

    (You can use window.location.hash to get the contents of the hash. See https://developer.mozilla.org/en/DOM/window.location)
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Addict
    Join Date
    Jul 2009
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    perfect!!! Thank so much for your help.

  4. #4
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm...I think this is an awesome javascript for my web layout, I need this and searching in may places but never find. Thank you for the reference.


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
  •