mirror of
https://github.com/Clortox/tylerperkins.xyz.git
synced 2026-03-07 10:37:58 +00:00
Add parallax effect to background
This commit is contained in:
@@ -4,6 +4,13 @@ window.onload = function() {
|
||||
document.querySelectorAll(".scramble").forEach(item => {
|
||||
item.addEventListener("mouseover", scramble);
|
||||
});
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
const parallax = document.querySelector('.parallax')
|
||||
let scrollPosition = window.pageYOffset;
|
||||
|
||||
parallax.style.transform = 'translateY(' + scrollPosition * .5 + 'px)';
|
||||
})
|
||||
}
|
||||
|
||||
function scramble(event){
|
||||
Reference in New Issue
Block a user