This time I will share jQuery Plugin and tutorial about Cool Background Image Transition Effects – jQuery bgChange, hope it will help you in programming stack.
bgChange is a small jQuery background slideshow plugin that automatically switches between background images with a cool configurable transition effect.
How to use it:
1. First you need to load the latest version of jQuery library in the document.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2. Download and load the bgChange plugin’s files in the document. Note that the JavaScript file ‘bgChange.js’ must be loaded after jQuery library.
1 |
< link rel = "stylesheet" href = "changContain.css" > |
2 |
< script src = "bgChange.js" ></ script > |
3. Basic usage:
- imagearray: an array of images to switch between
- options: plugin options
1 |
$( '.container' ).bgChange(imageArray,options); |
4. Advanced usage:
02 |
var data = [ '1.jpg' , '2.jpg' , '3.jpg' , '4.jpg' ]; |
06 |
var ele = $(init.ele); |
08 |
$.preLoad(data).then( function () { |
10 |
var imgChange = ele.bgChange(data, init); |
12 |
var timer = interval(imgChange); |
13 |
var changeFlag = false ; |
17 |
ele.on( 'click' , function () { |
18 |
if (changeFlag) return ; |
25 |
timer = interval(imgChange); |
29 |
ele.on( 'changeStart' , function () { |
32 |
ele.on( 'changeEnd' , function () { |
39 |
function interval(time) { |
40 |
return function (changeEle) { |
41 |
return setInterval( function () { |
47 |
bgAnimation({ele: '.container' }, interval(10000)); |
5. Default plugin options
01 |
$( '.container' ).bgChange(imageArray,{ |
This awesome jQuery plugin is developed by acccco. For more Advanced Usages, please check the demo page or visit the official website.