1
페이지 크기 조정이 발생할 때 각 div 섹션의 높이를 계산하는 기능에 문제가 있습니다. 재 장전 후 동일한 높이 값을 보여줍니다. 그러나 모든 것이 첫 페이지 로딩에서 괜찮습니다. 문제가 어디에 있습니까?jquery | 동적 div의 높이 변경
JS
$(document).ready(function() {
$(window).bind('orientationchange resize', function(e){
resize();
}).trigger('resize');
});
function resize() {
var vph = $(window).height();
$.each($('.st-panel'), function(index, value) {
var section_height = $(this).height() < vph ? vph : $(this).height();
$(this).height(section_height);
});
}
HTML은
<section class="st-panel" id="st-panel-1">...long text here...</section>
<section class="st-panel" id="st-panel-2">...long text here...</section>
<section class="st-panel" id="st-panel-3">...long text here...</section>
<section class="st-panel" id="st-panel-4">...long text here...</section>
<section class="st-panel" id="st-panel-5">...long text here...</section>