jquery-img-to-bg

A little plugin that makes css backgrounds out of imgs.


Keywords
jquery, img, css, bg, background
License
MIT
Install
bower install jquery-img-to-bg

Documentation

jQuery ImgToBg

A little plugin that makes css backgrounds out of imgs

Basic example:

var options = {
    backgroundRepeat: 'repeat-y'
};
$('.your-selector').imgToBg(options);

Available options:

  • backgroundSize
  • backgroundPosition
  • backgroundRepeat
  • backgroundColor

Get it through bower:

bower install jquery-img-to-bg

...or just get the file from the repo.

Oh, and you are probably just using .img-to-bg as the selector anyway, so you might want to give it display: none;, maybe put it in a style tag in your head.