Skip to content

codee47/jquery.adaptive-backgrounds.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery.adaptive-background.js

A simple jQuery plugin to extract the dominant color of an image and apply it to the background of its parent element.

Getting Started

Simply include jQuery and the script in your page, then run the script like so:

  $(document).ready(function(){
    $.adaptiveBackground.run()
  });

The script looks for image(s) with the data-adaptive-background attribute:

<img src="/image.jpg" data-adaptive-background='1'>

API

This plugin exposes one method:

  • $.adaptiveBackground.run(opts) arg: opts (Object) an optional argument to be merged in with the defaults.

Default Options

  • selector String (defult: '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.
  • parent String (defult: 'img[data-adaptive-background="1"]') a string which denotes which images to grab. Ideally, this selector would start with img, to ensure we only grab and try to process images.

Events Emitted

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ullamcorper justo sem. Fusce ac sem est. Aenean dignissim feugiat auctor. Vestibulum in ante sem. Ut sit amet erat arcu, eget fringilla odio. Aenean a nibh est. Cras metus urna, vulputate non feugiat vel, condimentum sit amet purus.

Caveats

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ullamcorper justo sem. Fusce ac sem est. Aenean dignissim feugiat auctor. Vestibulum in ante sem. Ut sit amet erat arcu, eget fringilla odio. Aenean a nibh est. Cras metus urna, vulputate non feugiat vel, condimentum sit amet purus.

Contact

lipsum.

License

Lipsum.

About

A jQuery plugin for extracting the dominant color from images and applying the color to their parent.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published