animating gradients gradientfade - Download Animating CSS Gradients With jQuery - gradientFade

Download Animating CSS Gradients With jQuery – gradientFade

Posted on

This time I will share jQuery Plugin and tutorial about Animating CSS Gradients With jQuery – gradientFade, hope it will help you in programming stack.

animating gradients gradientfade - Download Animating CSS Gradients With jQuery - gradientFade
File Size: 3.14 KB
Views Total: 1312
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

gradientFade is a jQuery plugin (script) to create a gradient transition effect by fading through a group of DIV containers with CSS gradients.

Based on the CSS transition and opacity properties.

See Also:

How to use it:

1. Add gradient backgrounds to the DIV elements as follows:

1 <div class="example">
2   <div style="background: linear-gradient(to right, #ee9ca7, #ffdde1)" class="gradient active"></div>
3   <div style="background: linear-gradient(to right, #c6ffdd, #fbd786, #f7797d)" class="gradient"></div>
4   <div style="background: linear-gradient(to right, #ee9ca7, #8a8a8a)" class="gradient"></div>
5   <div style="background: linear-gradient(to right, #34f351, #ffdde1)" class="gradient"></div>
6   <div style="background: linear-gradient(to right, #007991, #78ffd6);" class="gradient"></div>
7   ...
8 </div>

2. Make the gradient elements fullscreen.

1 .gradient {
2   position: absolute;
3   width: 100%;
4   height: 100%;
5   top: 0; left: 0;
6   z-index: 100;
7   opacity: 0;
8   transition: opacity 1s;
9 }

3. Set the opacity of the first element.

1 .gradient:first-of-type {
2   opacity: 1;
3 }

4. Import the latest version of jQuery JavaScript library into the html file.

2         integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
3         crossorigin="anonymous">
4 </script>

5. Download and load the JavaScript file gradientFade.js after jQuery.

1 <script src="gradientFade.js"></script>

6. Initialize the plugin and set the transiton delay in milliseconds. Done.

1 gradientFade(2000);

This awesome jQuery plugin is developed by HarryVerhoef. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net