Results 1 to 9 of 9

Thread: Need to Jump to anchor position

  1. #1
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need to Jump to anchor position

    I am using Montre (dmenu) to show hidden panels in the content area (the example is at:http://www.digitaljoe.info/testserver/products.html)

    My problem is that on smaller screens (15") it is hard to tell that a hidden div has been opened.

    Is it possible to add an anchor to the javascript to make the div appear and to jump to the displayed block?
    Last edited by ddadmin; 01-26-2007 at 02:00 AM.

  2. #2
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think this should work. Change this link:
    HTML Code:
    <a href="#" onclick="showhide('orderdetails'); return(false);">ORDER DETAILS OPEN/CLOSE</a>
    to:
    HTML Code:
    <a href="#details" onclick="showhide('orderdetails'); return(false);">ORDER DETAILS OPEN/CLOSE</a>
    And then above the code for the details div, put this:
    HTML Code:
    <a name="details"></a>

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You would probably want to take out the return(false); part as well. Just to be on the safe side.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply jonny - I forgot to give a pointer to the Component Box - being the issue (but the OpenClose) script has the same problem. Both are applying a display:block style.

    Even if I put the bookmark in visible content area (below the hidden div) for some reason the javascript used to apply the style="display:block" function is disabling the ahref=#(anchorname) navigation command.

    Am not enough of a jscripter to know what is happening to what.

    Joe

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Read my post above about the return false part. This is what is disabling your href attribute.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  6. #6
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Testingsite but I've been using that command to prevent jump to top of page - still think I have to put the anchors into an array and then call the anchor in javascript.......rather than from HTML command..

  7. #7
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Found one answer

    Hey!

    found that : location.hash = 'test'; (test is the anchor tag)

    will scroll the window to an anchor tag (even if it is in a hidden div)

    that's one solution - Oh for a smoothe scrollllllll

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <a href="#details" onclick="showhide('orderdetails'); return true;">ORDER DETAILS OPEN/CLOSE</a>
    ... will indeed work, and is also nicer for non-JS browsers.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Thetestingsite:

    Removing the return false statement did indeed make the show div function and anchor tag work - sorry for not listening

    JB

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
  •