From 35636d14da1a6f1fb4192573a84de8c1548e4acb Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Fri, 28 Jul 2023 22:44:21 -0400 Subject: [PATCH] Fix different size background on different pages --- content/_index.md | 2 +- themes/clortox/layouts/_default/baseof.html | 2 +- themes/clortox/static/js/script.js | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/content/_index.md b/content/_index.md index e2cc5b6..fe6b507 100644 --- a/content/_index.md +++ b/content/_index.md @@ -6,4 +6,4 @@ date: 2023-06-27 # Hi, I'm Tyler -Software engineer, aspiring postmath +software engineer, aspiring postmath diff --git a/themes/clortox/layouts/_default/baseof.html b/themes/clortox/layouts/_default/baseof.html index c0968d6..ffd0b5f 100644 --- a/themes/clortox/layouts/_default/baseof.html +++ b/themes/clortox/layouts/_default/baseof.html @@ -2,9 +2,9 @@ {{- partial "head.html" . -}} -
{{- partial "header.html" . -}}
+
{{- block "main" . }}{{- end }}
{{- partial "footer.html" . -}} diff --git a/themes/clortox/static/js/script.js b/themes/clortox/static/js/script.js index c87d322..8a714e1 100644 --- a/themes/clortox/static/js/script.js +++ b/themes/clortox/static/js/script.js @@ -7,9 +7,14 @@ window.onload = function() { }); window.addEventListener('scroll', function() { - const parallax = document.querySelector('.parallax') + let parallax = document.querySelector('.parallax') let scrollPosition = window.pageYOffset; + let newSize = (document.querySelector('#content').offsetHeight * 0.66); + if(newSize < window.innerHeight) + newSize = window.innerHeight; + parallax.style.height = newSize + "px"; + parallax.style.transform = 'translateY(' + scrollPosition * .5 + 'px)'; }) document.querySelectorAll(".typewriter").forEach(item => {