开发者

jquery shifting of popup when content increases

开发者 https://www.devze.com 2023-01-21 01:47 出处:网络
I have one div which is dynamic and getting the increments in the css dynamically from jquery to fit the contents if they are larger.

I have one div which is dynamic and getting the increments in the css dynamically from jquery to fit the contents if they are larger.

now the problem is that there is one popup associated with the same div.

if content increase that popup's comes down, I don't know how to solve this issue . please help.

HTML

< div id='main_div' >

< div id='myid' >some info< /div >

< div id='popup' >< /div >

< /div >


< input type='button' id='incre' >

jQuery:

$("#incre").click(function()
    {

$("#myid").html(" some more  some more  some more  some more  som开发者_如何学Pythone more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more  some more ");

    }); 

Thanks advance Dave


Set max height for this div. When content increases beyond this max height, use scrollbar to scroll contents.

div{
    max-height:300px;
    height:auto !important;          // for ie as it does not support max-height
    height:300px;                    // for ie as it does not support max-height
    overflow:auto;
    width:auto
} 


Have you tried using position absolute on the popup? Then the popup will not be affected by the height of the content div as it will be taken out of the flow of the document


I have increased the height of 'main_div' manually. and inserted the popup under that. and that worked.

Thanks all of you.

0

精彩评论

暂无评论...
验证码 换一张
取 消