我有正确的代码来均衡div,但我不知道"回到原来的高度"部分。
这是我到目前为止的代码:http://jsfiddle.net/5fTXZ/1/
jQuery:
// equalize height of columns
function equalHeight(group) {
tallest = 0;
group.each(function () {
thisHeight = $(this).height();
if (thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
// change to original height of columns
function originalHeight(group) {
// not sure what to put here
}
// change height based on windows size
function checkWindowSize() {
if ($(window).width() > 767) {
equalHeight($(".col"));
} else {
originalHeight($(".col"));
}
}
jQuery(document).ready(function ($) {
$(window).resize(checkWindowSize);
checkWindowSize();
});
当宽度大于767px时,您可以看到是否更改输出的窗口大小,div将在高度上相等。如果你将它改回到767px以下的宽度,它只会调用我尚未想到的空函数。
答案 0 :(得分:1)