angular-backgroundcover

Angular directove for jquery.backgroundcover


License
MIT
Install
bower install angular-backgroundcover

Documentation

AngularJS directive for jquery.backgroundcover

Requirements

Synopsis

Detects the browsers capability for background-size: cover and applies a shim when neccessary.

Usage

Include backgroundCover as module:

var app = angular.module('myApp', ['backgroundCover']);

Works on styled elements:

.background-cover {
	background: url('my/image.jpg') center center no-repeat;
	-moz-background-size: cover;
	-webkit-background-size: cover;
	background-size: cover;
}
<div class="background-cover"></div>
<div background-cover=""></div>

Elements with inline style will work as well:

<div class="background-cover" style="background-image: url('my/image.jpg');"></div>

Force usage of backgroundcover():

<div class="background-cover" image="my/image.jpg" force="true"></div>

Force element resize polling (instead of window.onresize):

<div class="background-cover" poll="true"></div>