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 9136647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:58:49+00:00 2026-06-17T08:58:49+00:00

I am having trouble with jquery expand and collapse. I am planning to have

  • 0

I am having trouble with jquery expand and collapse.

I am planning to have a read more function over my site and i want to make use of this example.

http://www.designgala.com/demos/collapse-expand-jquery.html

if you could see clicking the header expands the content and clicking twice gives a result of minimizing but my issue here is to show some part of the content like 30px height from the div and when the header is clicked it would expand and show the whole content.

  • 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-17T08:58:49+00:00Added an answer on June 17, 2026 at 8:58 am

    I created a jsfiddle which shows a way to do what you are looking to do.

    http://jsfiddle.net/cSvAB/2/

    Here is the javascript:

    $( '.section' ).each( function( index, value ){
    
        $( value ).data( 'height', $( this ).height() );
        $( value ).css( {height: 30} );
    });
    
    $( '.section .header' ).click( function(){
    
        if( $( this ).data( 'expanded' ) ){
    
          $( this ).parent().animate( {height: 30} );
          $( this ).data( 'expanded', false );
        }else{
    
          $( this ).parent( ).animate( {height: $( this ).parent().data( 'height' )} );
          $( this ).data( 'expanded', true );
        }
    });
    

    and here is the HTML:

    <div class="section">
      <div class="header">Click to read more</div>
      <div>Lots of text here</div>
    </div>
    
    <div class="section">
      <div class="header">Click to read more</div>
      <div>Lots of text here</div>
    </div>
    

    The only other important thing is that .section is given the css attribute overflow: hidden;

    .section{ overflow: hidden; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble with jQuery. I want to have a dialog box
Im having trouble with a jquery function where i have 5 option boxes (which
I'm having trouble understanding the jQuery pushStack function (documented at http://api.jquery.com/pushStack/ ). I have
I am having trouble using JQuery with ASP.net. I have a HTML img ,
Im having some trouble with jQuery's slideToggle function in IE8 for some reason the
I'm having trouble running a jQuery .post over each element in my table. The
I am having some trouble with Jquery append feature. I am wanting to have
I'm having trouble understanding how to use jQuery and its Form plug-in to access
I'm having trouble some jquery and was wondering if you could help. I have
I'm having trouble with jQuery and KnockoutJS. I'm trying to read a form with

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.