πŸ”” Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

A really small jQuery plugin which makes use of jQuery color.js library to apply a smooth color transition effect to background when you scroll down the webpage.

color scroll-effect color-transition

Documentation

Scrolling background color

Change the background color on scrolling

Usage

  1. Include jQuery & $.Color:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="http://code.jquery.com/color/jquery.color-2.1.0.js"></script>
  2. Include plugin's code:

    <script src="dist/jquery.scrolling-background-color.js"></script>
  3. Call the plugin:

    $(window).scrollingBackgroundColor(); // for the entire page background 	// or $('#element').scrollingBackgroundColor(); // for the background of #element
  4. Options:

    $( "#element" ).scrollingBackgroundColor( { 	from: "#CCCCCC", // startcolor 	to: "#FFFFFF", //tocolor 	target: 'body', // container changing colorΒ  	watch : '#element' // on scrolling } );

Demo

You will find a demo file on demo/index.html or live http://moshifr.github.io/scrolling-background-color/

Structure

The basic structure of the project is given in the following way:

β”œβ”€β”€ demo/ β”‚   └── index.html β”œβ”€β”€ dist/ β”‚   β”œβ”€β”€ jquery.scrolling-background-color.js β”‚   └── jquery.scrolling-background-color.min.js β”œβ”€β”€ .editorconfig β”œβ”€β”€ .gitignore β”œβ”€β”€ .jshintrc β”œβ”€β”€ .travis.yml β”œβ”€β”€ Gruntfile.js └── package.json 

You May Also Like