diff options
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 29 |
1 files changed, 5 insertions, 24 deletions
@@ -1,31 +1,12 @@ -particlesJS.load('particles-js', '/particles.json', () => - console.log('callback - particles.js config loaded') -); -// -// //canvas of the particles -// const particleWrapper = document.querySelector('#particles-js') -// console.log(document.body.scrollHeight, particleWrapper.style.height) - -const thresholdFidelity = 500; - -// const particleObserver = new IntersectionObserver(entries => { -// // note - if the boundingClientRect.y is negative, then they are scrolling down -// // note - since using id, only 1 entry -// console.log(entries[0]) -// const {intersectionRatio, boundingClientRect} = entries[0]; -// if (intersectionRatio !== 1) { -// console.log(particleWrapper.style) -// particleWrapper.style.top = `${parseFloat(particleWrapper.style.top.replace('px', '')) - boundingClientRect.top}px`; -// } -// }, { -// threshold: .5 -// }); -// particleObserver.observe(particleWrapper) +const THRESHOLD_FIDELITY = 1000; // mutation observer for the video element const videoTitle = document.querySelector('#video-title'); console.log(videoTitle); +const pastryIframe = document.querySelector('#connie-pastries') +console.log(pastryIframe.textContent); + const observer = new IntersectionObserver(entries => { // note - if the boundingClientRect.y is negative, then they are scrolling down @@ -37,7 +18,7 @@ const observer = new IntersectionObserver(entries => { videoTitle.currentTime = 2; } }, { - threshold: [...Array(thresholdFidelity).keys()].map(num => num/thresholdFidelity) + threshold: [...Array(THRESHOLD_FIDELITY).keys()].map(num => num/THRESHOLD_FIDELITY) }); // after two seconds pause the video |