Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8977615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:24:42+00:00 2026-06-15T19:24:42+00:00

I’m using jQuery’s slideToggle() function to control the expand/collapse feature of my website. Currently,

  • 0

I’m using jQuery’s slideToggle() function to control the expand/collapse feature of my website. Currently, I only have one page which has been developed upon before I implement it across the site; here it is.

By default, jQuery slideToggle() uses display=”block” which isn’t helping me. I’d like to make it use display=”inline-table” instead when a panel is expanded, and revert back to display=”none” when the same panel is collapsed.

There are a few settings I’ve applied to the CSS to make sure that the layout is how I want it to be:

.specs {
    width: 930px;
    height: 100px;
    border: none;
    color: #ffffff;
    font-weight: normal;
    display: none;
}

The height property is used to ensure that all of the icons within the panels are fully viewable. Removing this will cause smaller panels like ‘Memory’ to cut off half of the icon.

While collapsed, the panels are set to display=”none” to make sure they don’t affect the layout. However, upon expanding, they need to be set to display=”inline-table” to bypass some alignment issues which you can currently see when looking at panels like ‘Web Browsing’ and ‘Rear Camera’ (basically, the lists overlap the DIVs below, and the inline-table setting fixes that).

As soon as I’m able to fix this issue, I can move on to implement this design into other pages.

P.S. – Currently in use, is Redsquare’s method, so expanding is fine, but they don’t want to collapse.

Thank you,
Dylan.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:24:43+00:00Added an answer on June 15, 2026 at 7:24 pm

    This seems to work for me. Use min-height instead of height

    .specs {
        width: 930px;
        /*min-height: 100px; CHECK UPDATE */
        border: none;
        color: #ffffff;
        font-weight: normal;
        display: none;
    }
    

    UPDATE: See it in action at http://jsfiddle.net/LLQyV/1/

    Try this. Remove min-height from the CSS.

    In your HTML enclose each spec in a div classed as toggleContainer like so (I duplicated your general category and added various specs to each one.)

    <!-- General -->
    <div class="toggleContainer">
    <div class="spec-cat">
    <div class="spec-cat-content" id="general"><a href="#general">General</a>
    <span class="spec-cat-desc"></span></div>
    </div>
    <div class="specs" id="sec1">
        <ul>
            <li>Manufactured by HTC</li>
            <li>Also known as HTC Ville and HTC Z520e</li>
            <li>Released in March 2012</li>
            <li>£429 (GBP); $399 (USD)</li>
            <li>Manufactured by HTC</li>
            <li>Also known as HTC Ville and HTC Z520e</li>
            <li>Released in March 2012</li>
            <li>£429 (GBP); $399 (USD)</li>
        </ul>
    </div>
    </div>
    
    <!-- General -->
    <div class="toggleContainer">
    <div class="spec-cat">
    <div class="spec-cat-content" id="general"><a href="#general">General</a>
    <span class="spec-cat-desc"></span></div>
    </div>
    <div class="specs" id="sec1">
        <ul>
            <li>£429 (GBP); $399 (USD)</li>
        </ul>
    </div>
    </div>
    
    <!-- General -->
    <div class="toggleContainer">
    <div class="spec-cat">
    <div class="spec-cat-content" id="general"><a href="#general">General</a>
    <span class="spec-cat-desc"></span></div>
    </div>
    <div class="specs" id="sec1">
        <ul>
            <li>Manufactured by HTC</li>
            <li>Also known as HTC Ville and HTC Z520e</li>
        </ul>
    </div>
    </div>
    

    Then in your JS file do this (I combined all your onclick=’toggle’ calls into this)

    $(function() {
        $(".toggleContainer").each(function() {
            //store the .specs height to an unchanging attribute
            $(this).find(".specs").attr("specHeight", $(this).find(".specs").height());
    
            //when the cat is clicked, expand or collapse the spec
            $(this).find(".spec-cat-content").click(function(e) {
                e.preventDefault();
                //find spec for current toggleContainer that contains this category toggle button
                var spec = $(this).parent().parent().find(".specs");
    
                //check to see if the spec is displayed.
                if ($(spec).css("display") == "none") {
                    //if it isn't then animate to specHeight attr and display block                $(spec).height(0);
                    $(spec).css("display","block");
                    var newHeight=$(spec).attr("specHeight");
                    if(newHeight<100)
                        newHeight=100;
                    $(spec).animate({height:newHeight},400);
                }
                else {
                    //if it is, then animate to 0 height, and display:none
                    $(spec).animate({height:0},400,function(){$(spec).css("display","none");});
    
                }
            });
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I want use html5's new tag to play a wav file (currently only supported
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.