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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:07:48+00:00 2026-06-13T11:07:48+00:00

I have a div with four containers in it, it overflow hides some of

  • 0

I have a div with four containers in it, it overflow hides some of this content, and when it’s clicked I’d like it to animate to the height of the sum of these four containers. Right now it doesn’t quite go the full height and I’m not sure why. The container I’m trying to animate to a new height is news. I guess I have two questions, why is what I’m doing not animating it to the right height, and two is there a better way to add the contents of a container together? I have a js bin set up here http://jsbin.com/elijuj/2/edit and this is what I have for code right now:

HTML

<body>
<DIV id="container_total">
<div id="news" class="shadow blue">
  <div id="news_1">bla bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla 
blabla bla bla bla bla blabla bla bla bla bla bla</div>
  <div id="news_2">bla bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla 
bla</div>
  <div id="news_3">bla bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla 
blabla bla bla bla bla blabla bla bla bla bla bla</div>
  <div id="news_4">bla bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla  
blabla bla bla bla bla blabla bla bla bla bla bla</div>
</div>
<div id="photos" class="shadow blue">
</div>
<div id="welcome" class="shadow blue">
</div>
<div id="update_1" class="shadow blue">
</div>
<div id="update_2" class="shadow blue">
</div>
<div id="events" class="shadow blue">
</div>
<div id="directions" class="shadow blue">
</div>
</DIV>
</body>

CSS

#container_total {
width: 489px;
position: relative;
border: 1px solid red;
}
#news {
width: 314px;
height: 165px;
position: absolute;
top: 0px;
left: 0px;
overflow: hidden;
cursor: pointer;
}
#news_1 {
 padding-top:5px;
padding-bottom:5px;
padding-left:10px;
padding-right:10px;
border:1px solid blue;
}
#news_2 {
padding-top:5px;
padding-bottom:5px;
padding-left:10px;
padding-right:10px;
border:1px solid blue;
}
#news_3 {
padding-top:5px;
padding-bottom:5px;
padding-left:10px;
padding-right:10px;
border:1px solid blue;
}
#news_4 {
padding-top:5px;
padding-bottom:5px;
padding-left:10px;
padding-right:10px;
border:1px solid blue;
}



#photos {
width: 160px;
height: 165px;
top: 0px;
right: 0px;
position: absolute;
}
#welcome {
width: 489px;
height: 200px;
top: 180px;
position: absolute;
overflow: hidden;
}
#update_1 {
width: 160px;
height: 165px;
top: 395px;
right: 175px;
position: absolute;
overflow: hidden;
}
#update_2 {
width: 160px;
height: 165px;
top: 395px;
right: 0px;
position: absolute;
overflow: hidden;
}
#events {
width: 314px;
height: 165px;
top: 575px;
left: 0px;
position: absolute;
overflow: hidden;
}
#directions {
width: 160px;
height: 165px;
top: 575px;
right: 0px;
position: absolute;
z-index: 4;
overflow: hidden;
}
.shadow {
-webkit-box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, .3);
-moz-box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, .3);
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, .3);
}
.blue {
background: #eff5f8;
}

JS

$("#container_total").css("height", $("#news").height() + $("#welcome").height() +   
$("#update_1").height() + $("#directions").height() + 60);


function news_open() {

$("#container_total").animate({
"height": $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +  
$("#news_4").height() + $("#welcome").height() + $("#update_1").height() +   
$("#directions").height() + 60
}, 450 );

$("#news").animate({
"height": $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +     
 $("#news_4").height()
}, 450 );

$("#welcome").animate({
"top":180 + $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +  
$("#news_4").height() - 165
}, 450 );

$("#update_1").animate({
"top":395 + $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +  
$("#news_4").height() - 165
}, 450 );

$("#update_2").animate({
"top":395 + $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +  
$("#news_4").height() - 165
}, 450 );

$("#events").animate({
"top":575 + $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +  
$("#news_4").height() - 165
}, 450 );

$("#directions").animate({
"top":575 + $("#news_1").height() + $("#news_2").height() + $("#news_3").height() +  
$("#news_4").height() - 165
}, 450 );
}


$("#news").click(function() {
news_open();
});
  • 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-13T11:07:49+00:00Added an answer on June 13, 2026 at 11:07 am

    alrighty figured it out, two things were happening, the border of 1 px on each div that was not being acounted for, and because the contents of the div is text .height needed to be .innerHeight() for the news_1 through news_4

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

Sidebar

Related Questions

So currently I have: #div { position: relative; height: 510px; overflow-y: scroll; } However
I have four div s which are animated using size, height and positions; that
I have this code: <div class=container id=container> <div class=content id=content> <div class='nav'> <ul> <li><a
I have a nested div like this <div id=one> <div id=two> id two goes
I want to position four div s relative to another. I have a rectangle
I have replaced a table containing four tables (in a grid) with a div-table
If i have the following markup; <div id=container> <div id=box> <div id='sameHeight'>One<br>two<br>three</div> <div id='sameHeight'>four</div>
I have div ( #child ) which won't expand to the full height of
I have a data structure like this ( assume that the data structure is
I have four Div's one after the other inside a main div and aligned

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.