What would be better solution performance-wise - executing a function every 100 ms via setInterval or executing a function when page is scrolled? I just checked and single scroll can cause a function to be executed over 50 times. Setting setInterval to 100ms would cause function to be executed only 10 times per second but on the downside the function would be executed even if the page is not scrolled.
The function is rather simple (checkes window.pageYOffset and changes style if it's over 100)