Results 1 to 3 of 3

Thread: Implementing 'jump to certain anchor' in Accordion Content script

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Implementing 'jump to certain anchor' in Accordion Content script

    1) Script Title:

    Accordion Content script (v1.9)

    2) Script URL (on DD):

    http://www.dynamicdrive.com/dynamici...daccordion.htm


    3) Describe problem:

    Im using the Accordion Content script (v1.9)
    Some Accordions exceed the browers window height so that the jump to an implemented anchor (the accordions header) would be handy, as the user would not recognize the opening of that certain accordion.

    i know that it is possible to jump to an anchor with

    window.location.hash="anchorname";

    but i am not able to implement it into DD's Accordion Content Script.

    as i need to use the scripts OnClick function it is not possible to implement an anchor via href="#anchorname".

    i would like to add a function to the onclick event, is that possible ?
    onClick="ddaccordion.toggleone('headercl',1); return false"

    how could i achieve it to jump to a certain anchor(as each of the accordions headers are my anchors) with the help of this js function

    window.location.hash="anchorname";

    pls excuse my bad grammar / language

    thx in advance

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

    Default

    If I understand you correctly, you can call more than one function inside the onClick event handler just by separating each function with a semicolon. So in this case, something like:

    Code:
    onClick="ddaccordion.toggleone('headercl',1); window.location.hash="anchorname"; return false"
    DD Admin

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    if i do so either the javascript stops working (the specific accordion wont collapse anymore) or the anchor does not work alhtough there is #anchorname added to the url.

    i implemented it as followed:

    &nbsp;<a href="#" onClick="ddaccordion.toggleone('headercl',4); window.location.hash='anchor5'; return false;" >about</a> &nbsp;


    <!-- ACCORD CONTENTBOX #5 -->
    <div class="headercl" id="anchor5">about


    would it be possible to modify the script to wait a certain amount of ms and then jump to a specified anchor wich is unique to the accordions header ? like : header about always has the anchor "anchor5" or "about" to which the script will navigate via window.location.hash after tge user clicked.

    This would be perfect as it would allow the user to click the menubar and then would be routed to the specified accordion which has already done its opening animation.


    thx in advance

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
  •