简体   繁体   English

Bootstrap 自动高度面板

[英]Bootstrap Auto Height Panels

I have 3 panels (see image)我有 3 个面板(见图) 面板视图

Panel1 's height changing the height based on the content. Panel1的高度根据内容改变高度。 Panel2 has a fixed height. Panel2具有固定高度。 And my problem: I want for Panel3 a "perfect" height like height = panel1.height - panel2.height我的问题:我想要Panel3一个“完美”的高度,比如height = panel1.height - panel2.height

But I don't know how can I do that.但我不知道我该怎么做。

try something like this--试试这样的——

Using javascript使用 JavaScript

var panel1Height = document.getElementById('panel1').clientHeight;
var panel2Height = '20';
var panel3Height = panel1Height - panel2Height;
document.getElementById("panel3").style.height= panel3Height + 'px';

note this is just a mock up customize it according to your needs.请注意,这只是一个模型,根据您的需要对其进行自定义。

This framework does the work in a line height .. and always self-adjust if you put dynamic content这个框架在行height完成工作......并且如果你放置动态内容总是自我调整

Framework: https://github.com/mattbanks/jQuery.equalHeights code: https://codepen.io/micahgodbolt/pen/FgqLc框架: https : //github.com/mattbanks/jQuery.equalHeights代码: https : //codepen.io/micahgodbolt/pen/FgqLc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM