Advanced Search

Results 1 to 3 of 3

Thread: Display content in div on click?

  1. #1
    Join Date
    Feb 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display content in div on click?

    I want to use this Tab Content on a site
    http://www.dynamicdrive.com/dynamici...tabcontent.htm

    If you look at Demo #2 and click on TAB 2, two Arbitrary divs appear on the right. I want to make it so those divs are displayed when i click on the content inside of the tab box (Tab content 2 here), i tried to make it work but couldn't.

    I'd like to have a tab for photos and one for Videos. Small images would be inside of the tab box and when i click on the small photo an arbitrary div would display with a larger version of the photo. Similar with the video tab, but the arbitrary div would display a flash video.

    Anyone know how to edit this code to make that happen?

    thanks for looking

  2. #2
    Join Date
    Feb 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    anyone?

  3. #3
    Join Date
    Aug 2004
    Posts
    9,864
    Thanks
    3
    Thanked 960 Times in 949 Posts
    Blog Entries
    15

    Default

    Getting a DIV outside the Tab Content area to display isn't a complex task, so there's no reason to modify the script to accommodate this. Just use a separate JavaScript. For example, the below creates two links that when clicked on, shows/ hides a DIV on the page:

    Code:
    <script type="text/javascript">
    
    function showhide(divid, state){
    document.getElementById(divid).style.display=state
    }
    
    </script>
    
    <a href="#" onClick="showhide('testdiv', 'block'); return false" >Show DIV</a> | <a href="#" onClick="showhide('testdiv', 'none'); return false" >Hide DIV</a>
    
    <div id="testdiv" style="display:none">Some div here</div>
    Now, if the DIV contains a video, you'll need to somehow get the video to play as well when the DIV is revealed. How to do this depends on the public methods made available by the player for controlling it via scripting.

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
  •