jQuery on Scroll Background Animation

In this tutorial, we are going to see how to create background color animation on page scroll. In the previous article, we have seen background image animation.

In this example, we are using jQuery animate() function to do background animation effect. We are using an array of background colors to be changed on page scroll to create gradient background animation.

HTML DIV to Apply Background Animation

This DIV element id is specified as a selector to call jQuery animation.

<body>
<div id="bg-animate"> </div>
</body>

jQuery Background Animation

This jQuery script is called on page scroll and change the background-color index. The changed index is used to pick the color from the array to change the background=color of the DIV element with gradient animation.