У меня проблема с моей функцией, которая вычисляет высоту каждой секции div при изменении размера страницы. Он показывает мне такое же значение высоты после повторной установки. Но все в порядке при загрузке первой страницы. Где проблема?jquery | Изменение высоты divs динамически onresize
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>