PDA

View Full Version : Switch Content Script



karass
11-07-2006, 09:53 PM
1) Script Title:
Switch Content Script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

3) Describe problem:
First of all, I would like to say thanks to whoever wrote this srcript.

Second, does anyone know if there is a way to hide one div if user opens another? In other ways, script should only show one div at the time...

Thanks in advance.

Twey
11-07-2006, 10:07 PM
Contract all, then expand one.

karass
11-07-2006, 10:14 PM
Yes, that is a way, but I was looking for a way by not allowing a user to open more then one div at the same time.

Twey
11-07-2006, 10:25 PM
... which is what I suggested.
<h3 onClick="sweeptoggle('contract');expandcontent(this, 'sc1');" style="cursor:hand; cursor:pointer"><span class="showstate"></span>What is JavaScript?</h3>
<div id="sc1" class="switchcontent">
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client's browser and computer.
</div>

karass
11-08-2006, 05:46 PM
oh, thanks a lot! That was what I needed indeed. just couldn't explain myself properly...

joannek
11-20-2006, 02:36 PM
... which is what I suggested.
<h3 onClick="sweeptoggle('contract');expandcontent(this, 'sc1');" style="cursor:hand; cursor:pointer"><span class="showstate"></span>What is JavaScript?</h3>
<div id="sc1" class="switchcontent">
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client's browser and computer.
</div>
hi

it all works fine except where I insert the class="switchcontent" is where I currently have a css class providing a border for my div

inserting the 'switchcontent' class seems to override my css class ... any ideas would be welcome!

Twey
11-20-2006, 05:36 PM
Separate the classes with a space:
<div id="sc1" class="myclass switchcontent">