Improved responsiveness with a better JS algorithm to determine height

This commit is contained in:
2017-07-14 13:39:45 +02:00
parent b0d520c95a
commit cf23e30989
5 changed files with 96 additions and 75 deletions

View File

@ -32,19 +32,33 @@
}
});
$(window).resize(function() {resizeHeader()});
$(window).resize(function() {resizeHeader();});
resizeHeader();
function resizeHeader() {
var hide = true;
if ($('#scroll-arrow').is(':visible')) {
hide = false;
} else if ($(window).width() > 767) {
$('#scroll-arrow').show();
}
var overhang = $(window).height() - $('.top-content').outerHeight();
var height = $('.hidden-content').height();
var calculated = 200;
if ($(window).width() > 767) {
$('.below-header').height($('.hidden-content').height());
} else {
if ($('.hidden-content').is(":visible")) {
$('.below-header').height($('.hidden-content').height() + 200);
} else {
$('.below-header').height(200);
}
calculated = (height - overhang + ($(window).height() * 0.2));
} else if ($('.hidden-content').is(":visible")) {
calculated = (height - overhang + ($(window).height() * 0.5));
}
$('.below-header').height(calculated);
if (hide) {
$('#scroll-arrow').hide();
}
}