fix font size - flowtype - on hero when height is small aspect small

master
David Kebler 2017-03-22 20:19:31 -07:00
parent f5fbc56baf
commit 2bcbf6420d
1 changed files with 19 additions and 6 deletions

View File

@ -26,14 +26,27 @@ $('a[href*="#"]:not([href="#"])').click(function () {
}()); }());
// hero resizer // hero resizer
function heroResize() { function heroResize(bfr = 15) {
var h = $(window).height(),
w = $(window).width(),
fr = bfr * h / w
// console.log('w,h,fr', w, h, fr)
// minimum base font ratio
fr = (fr > bfr) ? bfr : fr
// adjust for short viewport height
fr = (w / h > 1 && h < 600) ? 15 * w / h : fr
//console.log('fr after', fr)
$('#hero').css({ $('#hero').css({
width: $(window).width() + 10, width: w + 10,
height: $(window).height() + 10 height: h / w > 1.5 ? w * 1.5 : h,
'margin-top': $('#nav-bar').height()
}); });
$('#hero').flowtype({ $('#hero').flowtype({
maxFont: 60, maxFont: 50,
fontRatio: 15 minFont: 18,
fontRatio: fr
}); });
} }
@ -41,7 +54,7 @@ function heroResize() {
function itemResize(item, maxWidth = 450, widthPadding = 30) { function itemResize(item, maxWidth = 450, widthPadding = 30) {
let windowWidth = $(window).width() let windowWidth = $(window).width()
let width = (windowWidth > maxWidth) ? maxWidth : windowWidth - widthPadding let width = (windowWidth > maxWidth) ? maxWidth : windowWidth - widthPadding
console.log(`passed width ${width}`) // console.log(`passed width ${width}`)
jQuery(item).fitToParent({ jQuery(item).fitToParent({
heightOffset: 0, // (int) Put some space around the element heightOffset: 0, // (int) Put some space around the element
// widthOffset: 5, // (int) Put some space around the element // widthOffset: 5, // (int) Put some space around the element