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 未満に戻すと、まだ理解していない空の関数が呼び出されます。