Skip to content

Commit a3052bf

Browse files
committed
edit readme
1 parent 039883c commit a3052bf

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The script looks for image(s) with the `data-adaptive-background` attribute:
1919
<img src="/image.jpg" data-adaptive-background='1'>
2020
```
2121

22-
A Lil' Demo
22+
Demo
2323
-----------
2424
Here's a little demo of how it works. (1) The page loads (2) the dominant background color of the image is extracted (3) said color is applied to parent of image.
2525
<img src="https://raw.github.com/briangonzalez/jquery.adaptive-background.js/master/misc/ab.gif">
@@ -34,12 +34,23 @@ Default Options
3434
- __selector__ String _(default: `'img[data-adaptive-background="1"]'`)_ a CSS selector which denotes which images to grab/process. Ideally, this selector would start with _img_, to ensure we only grab and try to process actual images.
3535
- __parent__ falsy _(default: `null`)_ a CSS selector which denotes which parent to apply the background color to. By default, the color is applied to the parent one level up the DOM tree.
3636

37+
__Example:__
38+
Call the `run` method, passing in any options you'd like to override.
39+
40+
```javascript
41+
var opts = {
42+
selector: '.some-selector',
43+
parent: '.some-parent-of-some-selector'
44+
}
45+
$.adaptiveBackground.run(opts)
46+
```
47+
3748
Events Emitted
3849
--------------
3950
- __ab-color-found__ [Event](http://api.jquery.com/category/events/event-object/) This event is fired when the dominant color of the image is found. The payload includes the dominant color as well as the color palette contained in the image.
4051

4152
__Example:__
42-
Subscribe to the __ab-color-found__ event like so:
53+
Subscribe to the `ab-color-found` event like so:
4354

4455
```javascript
4556
$('img.my-image').on('ab-color-found', function(payload){

0 commit comments

Comments
 (0)