progress on new website

This commit is contained in:
2023-05-19 07:53:09 +02:00
parent f659c53a64
commit d856df8e1b
7 changed files with 116 additions and 19 deletions

View File

@@ -1,11 +1,11 @@
$( document ).ready( function () {
document.addEventListener( 'scroll', scrolled );
document.addEventListener( 'resize', scrolled );
let revealables = document.querySelectorAll( '.reveal' );
let currentlyShowing = Math.floor( window.scrollY / ( window.innerHeight / revealables.length + 50 ) );
let heights = $( document ).height() / ( revealables.length + 1 );
let currentlyShowing = Math.round( window.scrollY / heights );
for ( let i = 0; i < currentlyShowing; i++ ) {
if ( i < parseInt( revealables.length ) ) {
@@ -14,7 +14,8 @@ $( document ).ready( function () {
}
function scrolled() {
let regPos = Math.floor( window.scrollY / ( window.innerHeight / revealables.length + 50 ) );
heights = $( document ).height() / ( revealables.length + 1 );
let regPos = Math.round( window.scrollY / heights );
if ( regPos < currentlyShowing && regPos < parseInt( revealables.length ) ) {
revealables[ regPos ].classList.remove( 'active' );
} else if ( regPos > currentlyShowing && regPos < parseInt( revealables.length ) + 1 ) {