<commit_before>## Overview

Background switching plugin for jQuery

## Usage

### Apply

```js
$('#example').bgSwitcher({
  images: ['/images/image.png', 1, 5] // image1.png, image2.png, ... image5.png
});
```

### Control

```js
// Get instance
var instance = $('body').data('bgSwitcher');

// Start
instance.start();

// Stop
instance.stop();

// Toggle
instance.toggle();

// Reset
instance.reset();
```<commit_msg>Update README for version 0.4<commit_after>jQuery.BgSwitcher
=========================

Overview
-------------------------

Switch the background image with effects.

Demo
-------------------------

http://rewish.github.io/jquery-bgswitcher/

Usage
-------------------------

```html
<div class="box">
  <p>Lorem ipsum dolor sit amet.</p>
</div>
```

```js
$(".box").bgswitcher({
  images: ["pic1.jpg", "pic2.jpg", "pic3.jpg"],
  ... Something Config ...
});
```

Config
-------------------------

| Key      | Type    | Default | Description |
| -------- | ------- | ------- | ------------|
| images   | Array   | []      | Background images |
| interval | number  | 5000    | Interval of switching |
| start    | boolean | true    | Start the switching at call `$.fn.bgswitcher(config)` ([Calling the Methods](#calling-the-methods)) |
| loop     | boolean | true    | Loop the switching |
| shuffle  | boolean | false   | Shuffle the order of an images |
| effect   | string  | fade    | Effect type ([Built-In effect types](#built-in-effect-types)) |
| duration | number  | 1000    | Effect duration |
| easing   | string  | swing   | Effect easing |

Effect Types
-------------------------

### Built-In effect types

* fade
* blind
* clip
* slide
* drop
* hide (No effect)

### Adding an effect types

First, Adding a method to `switchHandlers`.

```js
$.BgSwitcher.switchHandlers.extraSlide = function($el) {
  $el.animate({right: -$el.width()}, this.config.duration, this.config.easing);
};
```

Then, Specify the method name that you added.

```js
$(".box").bgswitcher({
  images: ["pic1.jpg", "pic2.jpg", "pic3.jpg"],
  effect: "extraSlide"
});
```

Calling the Methods
-------------------------

Support the method calls like jQuery UI Widget.

```js
$(".box").bgswitcher("method name");
```

You can call various methods, For example...

| Name    | Description |
| ------- | ----------- |
| start   | Start the switching |
| stop    | Stop the switching |
| toggle  | Toggle between start/stop |
| reset   | Return to the first switching |
| next    | To the next switching |
| prev    | To the previous switching |
| destroy | !!Destroy BgSwitcher!! |

Dependencies
-------------------------

Requires jQuery 1.7.x or higher.

Support browsers
-------------------------

* IE7+
* and modern browsers
* Mobile Safari

Running the Tests
-------------------------

Setup a modules required for testing.

```sh
git submodule update --init --recursive
```

You can testing in two ways:

* Open the `spec/index.html` in the Web browser
* Command Line Testing with the PhantomJS

```sh
phantomjs lib/mocha-phantomjs/lib/mocha-phantomjs.coffee spec/index.html
```

License
-------------------------

The [MIT License](https://github.com/rewish/jquery-bgswitcher/README.md), Copyright (c) 2009-2013 [@rewish](https://github.com/rewish).
{'fraction_non_alphanumeric': 0.2421731123388582, 'fraction_numerical': 0.009821976672805401, 'mean_word_length': 2.3807053941908713, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '435926', 'n_tokens_mistral': 1041, 'n_tokens_neox': 978, 'n_words': 285}