1.0.0 • Published 4 years ago
jquery-bg-image v1.0.0
Jquery BG Image JS
Zero Vulnerabilidades
Instalação
npm i jquery-bg-image --save
Usando:
HTML
<div id="bg-image"></div>
CSS
#bg-image {
width: 100%;
height: 100%;
background-size: cover;
background-position: center top;
background-image: url(harley-quinn.jpg);
}
JAVASCRIPT
$(document).ready(function () {
$("#bg-image").bgImage(function (event) {
/**
* Event Log
*/
console.log(event);
/**
* Get Object
* @type {*|jQuery}
*/
var background_image = $(this).get(0);
/**
* Get width
*/
console.log(background_image.width);
/**
* Get height
*/
console.log(background_image.height);
/**
* Get src
*/
console.log(background_image.src);
});
});
1.0.0
4 years ago