Results 1 to 2 of 2

Thread: Create link to content hidden by show/hide javascript

  1. #1
    Join Date
    Dec 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Create link to content hidden by show/hide javascript

    Hello, all.

    First time poster here. I may not ask my question in the most accurate way. I'm not even sure this is the appropriate forum for this question, so please be patient with this newbie.

    I would like to create a link to content that is hidden by a show/hide java script. Below is a generic version of that code, which is working perfectly. Within each one of the hidden contents I have threes divs with videos and text in them. I would like to create links to each one of them.

    XHTML
    Code:
    <p>***Visible content***
    <a href="#" id="example-show" class="showLink" 
    onclick="showHide('example');return false;">See more.</a>
    </p>
    <div id="example" class="more">
            <p>***Hidden content***</p>
            <p><a href="#" id="example-hide" class="hideLink" 
            onclick="showHide('example');return false;">Hide this content.</a></p>
    EXTERNAL CSS
    Code:
    .more {
            display: none;
    }
    
    a.showLink, a.hideLink {
            color: #000000;
    a.hideLink {
            background: transparent url('up.gif') no-repeat left; 
    }
    a.showLink:hover, a.hideLink:hover {
            border-bottom: 1px dotted #36f; 
    }
    JAVASCRIPT
    Code:
    function showHide(shID) {
            if (document.getElementById(shID)) {
                    if (document.getElementById(shID+'-show').style.display != 'none') {
                            document.getElementById(shID+'-show').style.display = 'none';
                            document.getElementById(shID).style.display = 'block';
                    }
                    else {
                            document.getElementById(shID+'-show').style.display = 'inline';
                            document.getElementById(shID).style.display = 'none';
                    }
            }
    }
    I hope my questions makes sense. Thanks in advance!

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Within each one of the hidden contents I have threes divs with videos and text in them. I would like to create links to each one of them.
    Your first block of code is doing that already (or maybe you mean to combine it with a named anchor/jump links?) but if this isn't what you want, please post a link to your page (the one you describe), not the generic code that is already working perfectly.
    I hope my questions makes sense. Thanks in advance!
    i couldn't see a question in your post. Can you please clarify what you would like help with? Maybe it will make more sense when you post a link to your actual page and show what you have already tried.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Replies: 2
    Last Post: 08-07-2013, 07:44 PM
  2. Replies: 1
    Last Post: 04-23-2010, 11:26 AM
  3. Replies: 1
    Last Post: 08-01-2009, 05:50 AM
  4. show/ hide image with link
    By johnwboyd in forum JavaScript
    Replies: 4
    Last Post: 09-18-2008, 04:47 PM
  5. [solved] Show/hide link does not work
    By rctxtreme in forum JavaScript
    Replies: 0
    Last Post: 04-05-2007, 06:37 AM

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
  •