Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    101
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Arrow Simplify this for me please

    hi guys,
    can someonr put this into an array for me please--don't know much about js.. much obliged for your help

    btw...when I call the site from google, the divs are open but when I call the site from my browser address bar...the divs are hidden as should be (only in firefox, otherwise great.

    Any ideas why that might be)

    thanks a ton
    DD

    Code:
    jQuery(document).ready(function() {
      jQuery(".content").hide();
      //toggle the componenet with class msg_body
      jQuery(".headinga").click(function()
      {
        jQuery(this).next(".content").slideToggle(500);
      });
    });
    jQuery(document).ready(function() {
      jQuery(".content").hide();
      //toggle the componenet with class msg_body
      jQuery(".headingb").click(function()
      {
        jQuery(this).next(".content").slideToggle(500);
      });
    });
    jQuery(document).ready(function() {
      jQuery(".content").hide();
      //toggle the componenet with class msg_body
      jQuery(".headingc").click(function()
      {
        jQuery(this).next(".content").slideToggle(500);
      });
    });
    Last edited by dododidi; 11-19-2010 at 07:52 PM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,026
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    PURE GUESS.
    Code:
    jQuery(document).ready(function() {
      jQuery(".content").hide();
      //toggle the componenet with class msg_body
      jQuery(".headinga").click(function()
      {
        jQuery(this).next(".content").slideToggle(500);
      });
      //toggle the componenet with class msg_body
      jQuery(".headingb").click(function()
      {
        jQuery(this).next(".content").slideToggle(500);
      });
      //toggle the componenet with class msg_body
      jQuery(".headingc").click(function()
      {
        jQuery(this).next(".content").slideToggle(500);
      });
    });
    Could surely be even simpler, but that should work.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •