4
我有一個絕對定位的div在相對定位的div內。relative div根據內容調整到絕對定位的div高度
我需要的家長相對div來重新大小到什麼都大小的絕對股利是(這是在哪一頁它是在根據動態變化)
我已閱讀,這可以使用jQuery做,但我不能讓它工作。
這是我有...
的Html
<div class="product-view">
<div style="float:left;">Product Image</div>
<div class="product-shop">
<div id="mm_grid_wrapper">
<table>dynamic content</table>
</div>
CSS ...
.product-view {
margin-top: 5px;
border: 1px solid #cecece;
padding: 22px 0 0 0;
position: relative;
bottom:0px;
}
.product-view .product-shop {
text-align: left;
width: 48%;
float: left;/*max-width: 329px;*/
}
#mm_grid_wrapper{
position:absolute;
left:10px;
margin:0 310px 0 0;
max-width: 1630px;
top:0;
height:100%;
}
}
的JavaScript ...
$(function()
{
$('.product-view') .css({'height': (($('#mm_grid_wrapper').height()) + 20)+'px'});
$('#mm_grid_wrapper').bind('resize', function(){
$('.product-view') .css({'height': (($('#mm_grid_wrapper').height()) +20)+'px'});
});
});
是不是有可能使相對mm_grid_wrapper?這樣父母會根據其大小自動調整大小。 – sroes 2013-03-05 14:39:26
@sroes其實我的HTML有點不對..我修改了。不,它必須是絕對的,否則它縮小到包裝div的大小。 – user1475110 2013-03-05 14:52:59