ちょっと問題があります。左の列と右の列のページレイアウトがあります。私は列を等しくしたいので、私はそれらを非常にうまく等しくするいくつかのjavascriptを使用しています。ただし、右側の列には、オンロードを非表示にし、押すと切り替えるdivがあります。私はjqueryを使用してこれを達成し、良い結果をもたらしています。問題は、最初のJavaScriptが両方の列の高さを修正していることです。高さがそれほど深くない場合、ユーザーがコンテンツの表示に切り替えると、コンテンツは両方の列の一番下の行より上に浮きます。それが理にかなっていることを願っています。
すべてをjqueryに変換すると、右のコンテナーの高さのサイズを非表示にする前に渡し、列の高さが小さすぎる場合は右に追加して、両方の列を水平にするという戦いのチャンスがあるかもしれないと考えていました。 。
これを説明するのは非常に難しいですが、うまくいけば、そこにいる誰かが私が達成しようとしていることを理解しています。
<script type="text/javascript">
$(document).ready(function () {
var contact_height = $("#ContentBlock").height();
$("#ContentBlock").hide();
$(".contact-us").click(function () {
if ($('#ContentBlock').is(":hidden")) {
$('#arrowopenclose').removeClass("panelCollapsed");
$('#arrowopenclose').addClass("panelExpanded");
} else {
$('#arrowopenclose').removeClass("panelExpanded");
$('#arrowopenclose').addClass("panelCollapsed");
}
$("#ContentBlock").slideToggle('fast');
return false;
});
})
</script>
<script type="text/javascript">
function fixHeight(one, two) {
if (document.getElementById(one)) {
var lh = document.getElementById(one).offsetHeight + 15;
//figure out how tall rh is and add contact_height + 15 if the space is smaller then contact_height
var rh = document.getElementById(two).offsetHeight;
var nh = Math.max(lh, rh);
document.getElementById(one).style.height = nh + "px";
document.getElementById(two).style.height = nh + "px";
}
}
window.onload = function () {
fixHeight('rightcolumn', 'content-container');
}
</script>