SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Jumping directly to a specific entry in an accordion

    I am using an accordion that came with an HTML web template that I purchased. Is there any way that I can link to a pane in the accordion using anchor tags like the following?


    <a name="tips">Useful Tips Section</a>
    <a href="#tips">Visit the Useful Tips Section</a>

    Here is the accordion html:

    <!-- pane -->
    <div class="title"><span>What are essential oils?</a></span></div>
    <div class="pane">
    <p>Sometimes called the "life force" of a plant, therapeutic grade essential oils are very complex. They are stored in special cells, ducts or glandular hairs that are distributed among the flowers, leaves, bark, stems and roots of a plant.</p>
    <div class="clear"></div>
    </div>
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Sure. Use something like

    Code:
    <a href="#tips">Visit the Useful Tips Section</a>
    and

    Code:
    <div class="title" id="tips"><span>What are essential oils?</a></span></div>
    It's a pity the code uses a div instead of a real heading element, though.

  3. #3
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do you have any other suggestions? I implemented your example into my code, then tried it out using:

    oil-testimonials.com/faq.php#linking

    The FAQ pulls up fine, but it doesn't open the section in the accordion about linking. Here is my php code:

    print ("<div class='title' id='linking'><span>Can I link to your testimonials on my own blog or website?</span></div>");
    Convert your dollars into silver coins. www.convert2silver.com

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    OK, I've moved this to the JS forum, as there's more to this than just HTML. I'm not sure how to make the accordion open with a link like this.

  5. #5
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Can anyone help me please?
    Convert your dollars into silver coins. www.convert2silver.com


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
  •