How to set two divs with same heights in JQuery

Jim

I am trying to make my second div changes it height dynamically when my first div changes without changing the second div height in css just with jquery:

This is my fiddle: http://jsfiddle.net/692QF/

My html code:

<div id='box'>
   <p>This is some text</p>
</div>
<div id='in'></div>

My css code:

#box{
background:#0066FF;
border:1px solid blue;
width:250px;
position:absolute;
top:10px;
left:10px;
padding:10px;
}
#in{
display:none;
background:#000;
position:absolute;
z-index:-1;
}
p{
color:white;
}

MY jquery code:

$('#box').hover(function(){
$('#in').toggle();
$('#in').css({
    'width' : '250px',
    'height' : '60px',
    'border' : '1px solid blue',
    'padding' : '10px'
});
});
Dustin Scott

I created this fiddle for you hope this what you want actually I didn't understand your question very well

Fiddle: http://jsfiddle.net/692QF/1/

var height = $('#box').height();
var width = $('#box').width();
var border = $('#box').css('border');
var padding = $('#box').css('padding');

$('#box').hover(function(){
    $('#in').toggle();
    $('#in').css({
        'width' : width,
        'height' : height,
        'border' : border,
        'padding' : padding
    });
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to set two divs with same heights in JQuery

From Dev

How to set two divs side-by-side with the same height?

From Dev

jquery crossfade two divs together in same function

From Dev

How do I get nested divs to be same height and expand to the largest of the heights?

From Dev

how to align two divs having same height?

From Dev

Bootstrap: how to stack divs of different heights?

From Dev

How to vertically line up DIVs with different heights

From Dev

How to vertically align divs of varying heights?

From Dev

How to set two divs side by side

From Dev

How to set two divs side by side

From Dev

How to get divs to be the same width in jQuery?

From Dev

Set Relative Layout to same heights as scroll view

From Dev

Set Relative Layout to same heights as scroll view

From Dev

Two divs in the same line

From Dev

css: set the height of floating divs as maximum of their heights with margins

From Dev

Want both divs to be set to the max of their heights on page load

From Dev

Prevent two divs from executing the same function jQuery

From Dev

jQuery: make two divs same height on window resize

From Dev

Resizing two divs at the same time using jquery-ui

From Dev

JQuery Same Height DIVs

From Dev

How do I make these two divs the same height?

From Dev

javascript - How to load two google charts on the same page, different divs

From Dev

How can I put two divs on the same line?

From Dev

How to have two sub-divs the same height as each other

From Dev

CSS: how to float two divs horizontally on the same line with consistent margin?

From Dev

How do i style two same class divs differently?

From Dev

How to set maximum widths and heights for pixmaps?

From Dev

Make two DIVs the same height?

From Dev

Make two DIVs the same height?

Related Related

  1. 1

    How to set two divs with same heights in JQuery

  2. 2

    How to set two divs side-by-side with the same height?

  3. 3

    jquery crossfade two divs together in same function

  4. 4

    How do I get nested divs to be same height and expand to the largest of the heights?

  5. 5

    how to align two divs having same height?

  6. 6

    Bootstrap: how to stack divs of different heights?

  7. 7

    How to vertically line up DIVs with different heights

  8. 8

    How to vertically align divs of varying heights?

  9. 9

    How to set two divs side by side

  10. 10

    How to set two divs side by side

  11. 11

    How to get divs to be the same width in jQuery?

  12. 12

    Set Relative Layout to same heights as scroll view

  13. 13

    Set Relative Layout to same heights as scroll view

  14. 14

    Two divs in the same line

  15. 15

    css: set the height of floating divs as maximum of their heights with margins

  16. 16

    Want both divs to be set to the max of their heights on page load

  17. 17

    Prevent two divs from executing the same function jQuery

  18. 18

    jQuery: make two divs same height on window resize

  19. 19

    Resizing two divs at the same time using jquery-ui

  20. 20

    JQuery Same Height DIVs

  21. 21

    How do I make these two divs the same height?

  22. 22

    javascript - How to load two google charts on the same page, different divs

  23. 23

    How can I put two divs on the same line?

  24. 24

    How to have two sub-divs the same height as each other

  25. 25

    CSS: how to float two divs horizontally on the same line with consistent margin?

  26. 26

    How do i style two same class divs differently?

  27. 27

    How to set maximum widths and heights for pixmaps?

  28. 28

    Make two DIVs the same height?

  29. 29

    Make two DIVs the same height?

HotTag

Archive