순수 CSS 솔루션에 대해 잘 모르겠지만 jQuery가이 문제를 해결할 수 있습니다.
의사 코드 :
// this returns the value of the browser's window's height in pixels
$height = $(window).height();
// this is considering that both subsections are next to each other (they take up 80% of the height)
$subsectionHeight = $height * 0.8;
를 또는, 하위 서로의 상단에있는 경우, 그들은 80을 차지 :
// Calculate height of screen
// Choose what percentage of that both subSections take up
// Remaining percentage is the height of the controlBox
은 그래서 jQuery를이 같이 조금 보일 수 있습니다 합계의 높이의 비율 :
$subsectionHeight = $height * 0.4;
// controlBox takes up 20% of height of window
$controlboxHeight = $height * 0.2;
// then you can assign the heights to each element
$('.subSection').css("height", "$subsectionHeight");
$('#controlBox').css("height", "$controlboxHeight");
나는 순수 CSS를 선호하지만 jQuery는 grea라는 것을 알고 있습니다. 때때로 사용하십시오.
jQuery를 모르거나 jQuery를 이해하는 데 어려움이있는 경우 Codecademy's jQuery course에 가입하는 것이 좋습니다.
그래서 어떻게 생겼을까요? 귀하의 질문에 모순이 있습니다. – zeroflagL
모순은 무엇입니까? 다시 말하자면 - section div에서 "position : fixed"(예 : 페이지 스크롤)와 동일한 동작을하는 상자 (#controlBox)가 있어야하지만 두 하위 섹션 아래에 위치해야합니다 –
'position : 고정 '은 페이지와 함께 스크롤하지 않음을 의미합니다. 스크롤 할 때 화면 위치에 그대로 있습니다. – zeroflagL