函数 equalHeight ,设置要应用的最小高度?
我已经尝试了一切,但是没有 javascript,我无法实现设计师给我的糟糕的布局!
<块引用>正如你所看到的,我有 div #backgr-box ,它必须使用 z-index 进行绝对定位,才能正确位于 #contenuto (它包含页面内容!!) 现在为了解决 #backgr-box 的可扩展性问题,如果 #contenuto 的内容长于侧边栏 #barra-teriore ,我有下面的代码可以工作,但它相反的情况则不行,请参阅页面:http://demo.liquidfactory.it/secondopolo/per-informarti
那么我如何告诉 javascript 仅在 div 侧边栏的最小高度上应用该计算#barra-teriore ??
需要帮助..拜托!
function equalHeight(group) {
tallest = 0;
group.each(function() {
thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight = $("#contenuto").height() - 380;
}
});
group.height(tallest);
}
$(document).ready(function() {
equalHeight($(".column"));
});
I have tried everything, but without javascript I cannot achieve the bad layout my designer gave to me!!
As you can see I have the div #backgr-box that has to be absolute positioned with z-index to be properly behind the #contenuto (which holds the page content!!)
Now to solve the extensibilty trouble of #backgr-box I have the below code that works if the content of #contenuto is longer than the sidebar #barra-laterale , but it is not ok in opposite case, see page: http://demo.liquidfactory.it/secondopolo/per-informarti
So how can I tell javascript to apply that calculation only over a minimum height of div sidebar #barra-laterale ??
Need help.. please!
function equalHeight(group) {
tallest = 0;
group.each(function() {
thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight = $("#contenuto").height() - 380;
}
});
group.height(tallest);
}
$(document).ready(function() {
equalHeight($(".column"));
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题可能出在这一行:
当前它将变量
tallest
和thisHeight
设置为内容区域的高度减去 380 像素。将其更改为:它会将所有列的大小调整为最高列的高度。
编辑:看起来您的右侧列实际上由具有
.barra- Laterale
类的多列组成,在这种情况下,您可能需要完全采取另一种策略:The problem is likely with this line:
Currently it is setting both the variables
tallest
andthisHeight
to the height of the content region minus 380 pixels. Change it to:And it will resize all the columns to the height of the tallest one.
Edit: It looks like your right-hand column actually consists of multiple columns with a class of
.barra-laterale
in this case you may want to take another tack altogether: