mirror of
				https://github.com/Clortox/tylerperkins.xyz.git
				synced 2025-07-17 14:42:11 +00:00 
			
		
		
		
	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 | ||||
| 
 | ||||
| Software engineer, aspiring postmath | ||||
| software engineer, aspiring postmath | ||||
|  | ||||
| @ -2,9 +2,9 @@ | ||||
| <html> | ||||
|     {{- partial "head.html" . -}} | ||||
|     <body> | ||||
|         <div class="parallax background"></div> | ||||
|         {{- partial "header.html" . -}} | ||||
|         <div id="content"> | ||||
|         <div class="parallax background" style="overflow-y: none;"></div> | ||||
|         {{- block "main" . }}{{- end }} | ||||
|         </div> | ||||
|         {{- partial "footer.html" . -}} | ||||
|  | ||||
| @ -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 => { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tyler Perkins
						Tyler Perkins