Fix different size background on different pages
This commit is contained in:
parent
f6caea99db
commit
35636d14da
@ -6,4 +6,4 @@ date: 2023-06-27
|
|||||||
|
|
||||||
# Hi, I'm Tyler
|
# Hi, I'm Tyler
|
||||||
|
|
||||||
Software engineer, aspiring postmath
|
software engineer, aspiring postmath
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
<html>
|
<html>
|
||||||
{{- partial "head.html" . -}}
|
{{- partial "head.html" . -}}
|
||||||
<body>
|
<body>
|
||||||
<div class="parallax background"></div>
|
|
||||||
{{- partial "header.html" . -}}
|
{{- partial "header.html" . -}}
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
<div class="parallax background" style="overflow-y: none;"></div>
|
||||||
{{- block "main" . }}{{- end }}
|
{{- block "main" . }}{{- end }}
|
||||||
</div>
|
</div>
|
||||||
{{- partial "footer.html" . -}}
|
{{- partial "footer.html" . -}}
|
||||||
|
@ -7,9 +7,14 @@ window.onload = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('scroll', function() {
|
window.addEventListener('scroll', function() {
|
||||||
const parallax = document.querySelector('.parallax')
|
let parallax = document.querySelector('.parallax')
|
||||||
let scrollPosition = window.pageYOffset;
|
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)';
|
parallax.style.transform = 'translateY(' + scrollPosition * .5 + 'px)';
|
||||||
})
|
})
|
||||||
document.querySelectorAll(".typewriter").forEach(item => {
|
document.querySelectorAll(".typewriter").forEach(item => {
|
||||||
|
Loading…
Reference in New Issue
Block a user