Results 1 to 2 of 2

Thread: Switch Content Script II -> Specify open/close for every instance

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

    Default Switch Content Script II -> Specify open/close for every instance

    Hey all,

    I'd like the ability to specify whether each individual instance is open or closed.

    I've seen code that states all open, or all closed on load.

    Perhaps pass an aditional parameter of initial state?

    Is there something out there already?

    No existing page for viewing, just a concept idea.

    Ideas?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This can be done (using the original DD version of the script) by simply marking each content element that you want originally hidden individually with inline style. From the demo:

    Code:
    <div id="sc2" class="switchcontent" style="display:none;">
    Java is completely different from JavaScript- the former is a compiled language while the later is a scripting language.
    </div>
    A nice touch would be that so (as is the original design of the script) these (now originally hidden) content elements can still be seen by non-javascript enabled browsers, use the noscript and script tags this way:

    Code:
    <noscript><div id="sc2" class="switchcontent"></noscript>
    <script type="text/javascript">
    document.write('<div id="sc2" class="switchcontent" style="display:none;">')
    </script>
    Java is completely different from JavaScript- the former is a compiled language while the later is a scripting language.
    </div>
    Last edited by jscheuer1; 02-26-2006 at 10:01 AM. Reason: Add Specifics and Advanced Method
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •