Animations are slowing the performance of web page
You can probably gain a lot of performance by using Intersection Observer (IO) instead of listening to the scroll event. IO was introduced because listening to the scroll event and calculating height/width of elements results in poor performance.
First you have to create a new observer:
var options = {
rootMargin: '0px',
threshold: 1.0
}
var observer = new IntersectionObserver(callback, options);
Here we specify that once the observed element is 100% visible, some callback should be executed.
Then you have to specify which items to observe, in your case I think this would be:
var target = document.querySelector('.wow');
observer.observe(target);
So we define that once any element with the class "wow" is visible on the page, the callback is getting executed:
var callback = function(entries, observer) {
entries.forEach(entry => {
// Each entry describes an intersection change for one observed
// target element:
});
};
Here you specify what should happen for each "wow"-Element in your page that is getting visible.
If you are using CSS for your animations and not JS then the animations should now be smooth. It also depends on what parameters you are animating, here is a good list of properties to avoid animating with CSS.
I won't copy the whole list here, but the most important ones would be padding, width, height and position.
Edit: If you need to support older browsers than use this (official) polyfill from w3c, it recreates intersection observer with listening to scroll events. So it will still be slower on older browsers, nothing you can do about it here. But on newer ones there will be an increase in performance.