473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Dynamic equal height with jQuery

damir
14
Hi everyone!

I have a problem with dynamic height. I've made an equal height function which basically works when it's called, but the problem is with jquery animations, to be more precise with slideDown function in combination with ajax.

The right side (see image below) is a place for comments, and after each submitted comment with ajax it's added with slideDown function. I don't know how to make that both section heights change their height dynamically during the slideDown animation.

Scheme:



Code:
Expand|Select|Wrap|Line Numbers
  1. function SetHeight()
  2. {  
  3.    var tallest = 0;  
  4.    $("#content > section").height('auto');
  5.  
  6.    if ($("section#left, section#right").size() > 1)
  7.    {
  8.       $("#content > section").each(function()
  9.       {
  10.          height = $(this).height();
  11.          if (height > tallest)
  12.             tallest  = height;
  13.       });  
  14.  
  15.       $("#content > section").height(tallest); 
  16.    }
  17. }
  18.  
  19. $(document).ready(function(){
  20.    SetHeight();
  21. }
  22.  
  23. $('form').submit(function(event){
  24.    event.preventDefault();
  25.    $('button[type=submit]').attr('disabled', 'disabled');
  26.  
  27.    $.post('/script/shift-comment',
  28.    {
  29.       shift: $('input[name=shift]').attr('value'),
  30.       message: $('textarea').val()
  31.    },
  32.    function(data)
  33.    {
  34.       $(data).insertBefore('#comment').hide().slideDown();
  35.       $('textarea').val('');
  36.    });     
  37. });
Mar 29 '11 #1
0 986

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Linda Antonsson | last post by:
Hi, I am trying to put together a CSS-based layout consisting of a header, a sidebar and a main content area. Page: http://www.westeros.org/ASoWS/ CSS:...
6
by: veerleverbr | last post by:
Hi, I have the following html: <div id="content"> <div id="leftpart">...</div> <div id="rightpart">...</div> </div> leftpart en rightpart are in the css set to float left. The content of...
1
by: Andy Jeffries | last post by:
Hi all, I want to have two elements have an equal height, with that height being the larger of the two (with dynamic content). In one case they are just side by side so I want them to look even...
3
by: Jensen bredal | last post by:
Hello, How can i dynamically change the height of my <div></div> element on my webform. I use C# and i want this height to be set according to screen resolution, tipically in my code behind...
18
by: zzpat | last post by:
I've come to the conclusion that float was never made for designing a page, but is there a good way to float three columns with the following characteristics? leftColumn 20% rightColumn 20%...
0
by: Nik Coughlin | last post by:
Something that I've been trying to do for a long time is a 3 column layout where all three columns have equal height, and have rounded corners implemented using PNGs with alpha. One of my early...
0
by: chona | last post by:
hello, Is there a way that I can set the row height in a crystal report crosstab to be dynamic. Like the height of the row should depend on the data inside the cell. Please help!
1
by: jaiwin | last post by:
If any one know the dynamic div height according to the page height.
0
by: Peter | last post by:
I have a datalist and I want the datalist to grow from no recors to fill the screen, but not go beyond the screen height. How do I do that? I've implemented the scroll bars but that's for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.