How to keep div height fixed during changing its content?

qadenza
<div id='wrapT'>some stuff here</div>
<div id='btnsT'>
<img id='prev' src='btns/prev_01.png' alt='prev'>
<img id='next' src='btns/next_01.png' alt='next'>
</div>

js

    $('#btnsT #next').click(function(){
    var a = $('#divsT > div').eq(xdiv).html();
    $('#wrapT').html(a);
});

#wrapT changes its content correctly, but it firstly changes its height to 0 for a few seconds, then come back to original height.

How to keep the height fixed during this process?

IMPORTANT: both the old and the new content is 450px in height.

I tried in css:

#wrapT{
    height:450px;
}

But in this case there is a problem during re-sizing the window - it stays always 450px.

also tried to add in btn click event:

var x = $('#wrapT').height();
$('#wrapT').css('height', x + 'px');
$('#wrapT').html(a);
$("#wrapT").css('height', 'auto');

witout success. #wrapT keeps to change its height.

Jamie Barker

I have done something similar before. What you can do is load the next item behind the current one with visibility:hidden; and possibly a lesser z-index. This means the shape of wrapT will stay.

You can then do something like:

$('#OldItem').fadeOut(400, function() {
   $(this).remove();
});
$('#NewItem').fadeIn(400)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

UIImageView with fixed width: how to set its height to keep its aspect?

From Dev

UIImageView with fixed width: how to set its height to keep its aspect?

From Dev

css:- changing { height: fixed } to {height : fit to content}

From Dev

How to keep panel height fixed with scroll if content overflow for JQuery Mobile

From Dev

Expanding content div with fixed height

From Dev

how to keep fixed height for th

From Dev

Div float keep fixed and 100% height of the viewport

From Dev

How to get the height of a div after its content is loaded?

From Dev

How to get the height of a div after its content is loaded?

From Dev

DIV element not changing height with content in responsive theme

From Dev

Keep inner div from expanding beyond fixed height outer div

From Dev

Jquery: Changing Content of a div modifies its behaviour

From Dev

Need to keep image (horizontal / vertical) in a fixed height div

From Dev

tkinter frame: fix frame height when changing its content

From Dev

Flutter Card height not changing with respect to its Child Content

From Dev

How to create fixed, scrollable div with percentage height?

From Dev

How to make outer div expand to the height of all its dynamically generated content?

From Dev

How do I make a div height or position adapt to its content's relative position

From Dev

How to fit DataGridView width and height to its content?

From Dev

How to copy formula without changing its content?

From Dev

How to vertically center images of dynamic height inside a div of fixed height?

From Dev

How to add a class if div height reaches a fixed height?

From Dev

How to vertically center images of dynamic height inside a div of fixed height?

From Dev

How can I make a fixed top menubar with a changing height in CSS?

From Dev

How to keep div same height at all times

From Dev

Create fixed div height

From Dev

How to make UITextView in section header adjust its height to its content

From Dev

div height adjusting doesn't include margin of its content

From Dev

How to cover a div with an image independently of its height?

Related Related

  1. 1

    UIImageView with fixed width: how to set its height to keep its aspect?

  2. 2

    UIImageView with fixed width: how to set its height to keep its aspect?

  3. 3

    css:- changing { height: fixed } to {height : fit to content}

  4. 4

    How to keep panel height fixed with scroll if content overflow for JQuery Mobile

  5. 5

    Expanding content div with fixed height

  6. 6

    how to keep fixed height for th

  7. 7

    Div float keep fixed and 100% height of the viewport

  8. 8

    How to get the height of a div after its content is loaded?

  9. 9

    How to get the height of a div after its content is loaded?

  10. 10

    DIV element not changing height with content in responsive theme

  11. 11

    Keep inner div from expanding beyond fixed height outer div

  12. 12

    Jquery: Changing Content of a div modifies its behaviour

  13. 13

    Need to keep image (horizontal / vertical) in a fixed height div

  14. 14

    tkinter frame: fix frame height when changing its content

  15. 15

    Flutter Card height not changing with respect to its Child Content

  16. 16

    How to create fixed, scrollable div with percentage height?

  17. 17

    How to make outer div expand to the height of all its dynamically generated content?

  18. 18

    How do I make a div height or position adapt to its content's relative position

  19. 19

    How to fit DataGridView width and height to its content?

  20. 20

    How to copy formula without changing its content?

  21. 21

    How to vertically center images of dynamic height inside a div of fixed height?

  22. 22

    How to add a class if div height reaches a fixed height?

  23. 23

    How to vertically center images of dynamic height inside a div of fixed height?

  24. 24

    How can I make a fixed top menubar with a changing height in CSS?

  25. 25

    How to keep div same height at all times

  26. 26

    Create fixed div height

  27. 27

    How to make UITextView in section header adjust its height to its content

  28. 28

    div height adjusting doesn't include margin of its content

  29. 29

    How to cover a div with an image independently of its height?

HotTag

Archive