View Full Version : Display content in div on click?

05-29-2008, 12:06 AM
I want to use this Tab Content on a site

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

05-29-2008, 03:26 PM

05-29-2008, 07:43 PM
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:

<script type="text/javascript">

function showhide(divid, state){


<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.