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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:45:51+00:00 2026-06-16T07:45:51+00:00

I have made an example: http://jsfiddle.net/YfV7G/4/ It’s a div like this <div id=container> <h2>The

  • 0

I have made an example: http://jsfiddle.net/YfV7G/4/

It’s a div like this

<div id="container">
    <h2>The header</h2>
    <a href="#">One of dynamic ammount of links</a>
    <a href="#">One of dynamic ammount of links</a>
    <a href="#">One of dynamic ammount of links</a>
    <a href="#">One of dynamic ammount of links</a>
    <a href="#">One of dynamic ammount of links</a>
</div>

That I change the height of by:

$('#container').animate({
    height: '5px'
}, 1000, null);​

Css is overflow:hidden

I change the height to only show the topmost part of a div.

But what should I set the height to to get it back and show the full content?

One way I could think of myself is to save it before making it smaller. Is there another option?
(That way wont for if there is content changes after the height is saved, which it might)

  • 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-16T07:45:52+00:00Added an answer on June 16, 2026 at 7:45 am

    You could store the initial height in a rel attribute and retrieve it later. Something like this:

    var container = $("#container");
    
    container.attr('rel', container.height()).animate({
        height: '40px'
    }, 1000, null);
    
    container.hover(
      function() {
        $(this).height(container.attr('rel'));
      },
      function() {
        $(this).animate({
          height: '40px'
        }, 1000, null);
      }
    );
    

    Example:
    http://jsfiddle.net/kvZ26/

    EDIT:
    This is the updated answer which should work with dynamically generated content. Depending on your styling you might need to use .outerHeight() when retrieving the value.

    var container = $("#container");
    
    container.attr('rel', container.height()).animate({
        height: '40px'
    }, 1000, null);
    
    container.hover(
      function() {
        var height = $("#container > h2").height() + ($("#container > a").height() * $("#container > a").length);
        $(this).height(height);
      },
      function() {
        $(this).animate({
          height: '40px'
        }, 1000, null);
      }
    );
    

    (You might want to tweak it so you don’t need to duplicate the container id).

    Example:
    http://jsfiddle.net/xDCsY/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made this example in jsfiddle to demonstrate my problem: http://jsfiddle.net/paulmason411/7E6vG/ See how the
Currently i have made a bar chart from a listbox from this example: http://weblogs.thinktecture.com/cnagel/2011/06/wpf-listbox-as-bar-chart.html
I made the following fiddle as an example: http://jsfiddle.net/GR7pg/ but need it to move
http://jsfiddle.net/PerryCS/zFewp/2/ Hi there, I have played around with this for ~6 hours now and
http://jsfiddle.net/Cyjye/ I m new to jquery. I have made html table shown in jsfiddle.Firstly
I have a slider I made: http://dranz1r.com/index.html When you slide right for example, there
I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>
I am puzzled by this: I have made a very simple example: MainWindow.xaml: <Window
http://jsfiddle.net/nicktheandroid/GPFxM/28/ I've also explained the situation in the JS Fiddle example. I binded hover
I have got some markup that looks like this: <div class=button> <span class=image></span> <input

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.