【发布时间】:2018-12-24 10:34:40
【问题描述】:
这是一支笔:https://codepen.io/anon/pen/LBNyXP?editors=1111
如果您更改视口的高度,高度会上升,但不会下降。我认为既然它可以增加,它应该也可以减少,但事实并非如此。
在“整页”模式下观看效果最佳:
$(document).ready(function() {
$(window).on('load resize', function() {
var parentHeight = $('#parent').outerHeight();
console.log('height', parentHeight);
$('#grandchild').css('height', parentHeight);
});
});
#parent {
display: flex;
min-height: 100vh;
flex-direction: column;
}
#parent #child {
flex: 1 0 auto;
display: flex;
flex-direction: column;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="parent">
<div id="child">
<div id="grandchild">Grandchild</div>
</div>
</div>
【问题讨论】:
标签: jquery flexbox zurb-foundation