http://www.tigerstudiodesign.com/blog/
有时匹配高度不够快,尤其是当您单击链接转到另一个页面时。除非我刷新,否则高度不会相互匹配。
我用来匹配高度的代码:
function matchColHeights(col1, col2) {
$('img').load(function() { //let images load before I get the height, else height is calculated based on text alone
var col1Height = $(col1).height();
//alert('col1: '+col1Height);
var col2Height = $(col2).height();
//alert('col2: '+col2Height);
if (col1Height < col2Height) {
$(col1).height(col2Height);
} else {
$(col2).height(col1Height);
}
});
}
$(document).ready(function() {
matchColHeights('#leftPanel', '#rightPanel');
});
任何想法?