diff --git a/site/themes/dojo/layout/_partial/landingPage/upAndRunning.ejs b/site/themes/dojo/layout/_partial/landingPage/upAndRunning.ejs index b2d875eb5..ec137711e 100644 --- a/site/themes/dojo/layout/_partial/landingPage/upAndRunning.ejs +++ b/site/themes/dojo/layout/_partial/landingPage/upAndRunning.ejs @@ -110,13 +110,19 @@ requestAnimationFrame(animate); } - + var typing1Elem = document.querySelector('#upAndRunning-typing-1 .typed-text'); + var fontSize = window.getComputedStyle(typing1Elem, null).getPropertyValue('font-size'); + + window.onresize = function() { + fontSize = window.getComputedStyle(typing1Elem, null).getPropertyValue('font-size'); + } function updateTyping1Animations(percentCompletion) { + var width = calculateWidth(typing1Elem); var typing = { x1: 0, x2: 0.15, - y1: 0, y2: 365 + y1: 0, y2: width }; var fadeIn = { x1: 0.15, x2: 0.2, @@ -133,13 +139,14 @@ var typing2Elem = document.querySelector('#upAndRunning-typing-2 .typed-text'); function updateTyping2Animations(percentCompletion) { + var width = calculateWidth(typing1Elem); var delayShow = { x1: 0.25, x2: 0.26, y1: 0, y2: 1 }; var typing = { x1: 0.25, x2: 0.4, - y1: 0, y2: 350 + y1: 0, y2: width }; var fadeIn = { x1: 0.4, x2: 0.45, @@ -204,6 +211,13 @@ } } + function calculateWidth(el) { + var textLen = typing1Elem.textContent.length; + var buffer = 5; + return (parseFloat(fontSize) * textLen) / 2 + buffer; + } + requestAnimationFrame(animate); + })(); diff --git a/site/themes/dojo/source/css/_partials/landingPage/upAndRunning.scss b/site/themes/dojo/source/css/_partials/landingPage/upAndRunning.scss index aab23c43e..f1b6717a9 100644 --- a/site/themes/dojo/source/css/_partials/landingPage/upAndRunning.scss +++ b/site/themes/dojo/source/css/_partials/landingPage/upAndRunning.scss @@ -32,6 +32,7 @@ section.up-and-running { @media screen and (max-width : $mobile-break) { padding: 3vh 5vw; + width: 100%; } margin: auto; @@ -60,6 +61,7 @@ section.up-and-running { @media screen and (max-width : $mobile-break) { font-size: 30px; padding-right: 0.3em; + width: 100%; } } &.typed-text { @@ -77,6 +79,7 @@ section.up-and-running { @media screen and (max-width : $mobile-break) { margin-bottom: 10px; + font-size: $base-pre-font-size-mobile } } } diff --git a/site/themes/dojo/source/css/_util/variables.scss b/site/themes/dojo/source/css/_util/variables.scss index a62f58a15..57730efe2 100644 --- a/site/themes/dojo/source/css/_util/variables.scss +++ b/site/themes/dojo/source/css/_util/variables.scss @@ -53,6 +53,7 @@ $global-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hel $base-code-font-size: 0.85rem; $base-code-color: #032f62; $base-pre-font-size: 0.85rem; +$base-pre-font-size-mobile: 0.75rem; $base-code-font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace; $heading-font: 'Montserrat', sans-serif; $base-heading-font-family: $heading-font; @@ -61,4 +62,4 @@ $navbar-dropdown-nav-font-size: $navbar-nav-item-font-size; $subnav-item-font-size: $navbar-nav-item-font-size; $nav-primary-item-font-size: 0.95rem; $navbar-dropdown-width: 165px; -$navbar-dropdown-margin: 0; \ No newline at end of file +$navbar-dropdown-margin: 0;