PDA

View Full Version : Switch Content - noscript collapsed?



StickBoy
08-31-2009, 06:15 PM
1) Script Title: Switch Content

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

3) Describe problem: When loading the page without JavaScript enabled, all "hidden" blocks are revealed, as the script is designed to do. Is there something I can add or change so that a browser not running JavaScript will display none of the hidden blocks?

Thanks!

ddadmin
09-02-2009, 10:50 AM
You can always manually add CSS that hides the expandable contents. Lets say you have the following two contents:


<h3 id="bobcontent1-title" class="handcursor">What is JavaScript?</h3>
<div id="bobcontent1" class="switchgroup1">
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>


<h3 id="bobcontent2-title" class="handcursor">Difference between Java & JavaScript?</h3>
<div id="bobcontent2" class="switchgroup1">
Java is completely different from JavaScript.
The former is a compiled language while the later is a scripting language.
</div>

Inside the HEAD section of your page, you'd target the "switchgroup1" class:


.switchgroup1{
display:none;
}

StickBoy
09-03-2009, 09:17 PM
You can always manually add CSS that hides the expandable contents.

When I looked at this, it didn't make sense. How could it possibly work?

Nevermind questioning it, just try it!

I tried it and it worked.

I don't know why it worked, but it did, and that's all I really care about! :D

Thank you so much!