我正在构建一个网站,动态地定位内容在一组部分的中间。每个不封装块
股利与图像背景(全宽度的图像 - FWI)
股利与图像背景(不同高度的)
我的问题是即使在每个选择器的第一个div是用来决定了高度下面的所有其他div的,我显然缺少的东西非常基本的
jQuery的
jQuery(window).on("resize", function() {
jQuery('.fwi').each(function() {
jQuery('.image-outer').height(jQuery('.fwi-image').height());
});
}).resize();
jQuery(".fwi-image img").load(function() {
jQuery('.fwi').each(function() {
jQuery('.image-outer').height(jQuery('.fwi-image').height());
});
});
HTML
<div class="fwi">
<div class="relative">
<div class="fwi-image full-width">
<img width="1920" height="1080" src="">
</div>
<div class="outer image-outer" style="height: 1080px;">
my content which is dynamically positioned in the center vertically in my div
</div>
</div>
</div>
<div class="fwi">
<div class="relative">
<div class="fwi-image full-width">
<img width="1920" height="1200" src="">
</div>
<div class="outer image-outer" style="height: 1080px;">
will take height from previous image-outer not its parent - it should be 1200
</div>
</div>
</div>
这里是网站: 你可以看到第二画面块文本被坐得低,因为其拍摄第一张照片块的大小 http://prestlaundry.com/ –