https://github.com/rocity/jquery-bgimg
Make images become background-images for HTML elements
https://github.com/rocity/jquery-bgimg
jquery jquery-plugin
Last synced: 6 months ago
JSON representation
Make images become background-images for HTML elements
- Host: GitHub
- URL: https://github.com/rocity/jquery-bgimg
- Owner: rocity
- License: mit
- Created: 2016-08-01T06:00:14.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-15T05:45:50.000Z (almost 10 years ago)
- Last Synced: 2025-04-15T13:51:40.319Z (over 1 year ago)
- Topics: jquery, jquery-plugin
- Language: JavaScript
- Size: 387 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bgimg
Make images become `background-image`s for HTML elements.
# Installation
`jQuery` is a dependency for `jquery.bgimg.js`.
Clone this repo then copy `jquery.bgimg.js` into your project directory.
```html
```
# Options
| Option | Description |
| ------------- | ------------- |
| `data-bgimg` `backgroundImage` | The image that you want as background |
| `data-bgimg-repeat` `backgroundRepeat` | The option for how your background image is repeated |
| `data-bgimg-size` `backgroundSize` | The size of your background image |
| `data-bgimg-position` `backgroundPosition` | The position of your background image |
| `data-bgimg-color` `backgroundColor` | *Bonus* The background color of your target element |
*Note: data-attributes take precedence over options declared using JS.*
# Example
```html
$('#demo').bgimg();
```
Check out the [docs](./docs/) directory for more examples on how to use this plugin.
# License
This software is licensed under [The MIT License](./LICENSE).