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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:40:08+00:00 2026-06-04T08:40:08+00:00

I’m working on a small jQuery thingy and I’m for about 90% done (on

  • 0

I’m working on a small jQuery thingy and I’m for about 90% done (on my own i might add). But now I hit a wall since my code has gotten a bit bigger and I can’t seem to find my last problem.

http://jsfiddle.net/7TRqh/
On this jsFiddle you can see my project.

I have 3 (or more/less) different div’s that all variable in height. The buttons “meer” and “minder” make the elements slide up/down, this works all fine (allthough the code might be a bit messy).

But the problem is that it only grabs the variable height of the first element. 192px and uses that for all the elements allthough they are much heigher. So there’s something wrong with the variable

        var currentHeight = $('.book').css('height');
            $('.book').css('height','auto');
        var animateHeight = $('.book').css('height');
            $('.book').css('height', currentHeight);

But I can’t really seem to find the mistake, I hope someone over here can help me out with this last little problem.

  • 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-04T08:40:10+00:00Added an answer on June 4, 2026 at 8:40 am

    If you call $('.book') you call all the elements with the class book, and you will only receive the height of the first element (because you are asking for a single value: the height. It cannot return an array.

    What you probably need to do is give each different .book element a different id, like book1, book2 and book3. You can now get the height of each of the different books.


    EDIT:

    $('#myID').click (function () {
      // do some expanding
      // let's get the height!
      $(this).css('height'); // this is the height of the current clicked item. 
      $(this).parent.css('height'); // this is the height of the parent of the clicked item.
    }
    

    You can also call this function on a group of elements, for example $('.book .meerButton').click(function(){});

    The $(this) variable is really nice, if you’ve never seen it before, read something about it in the jQuery docs.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.