directive:mohistory.imageCover source

Applies CSS classes to resize images, so they maintain their aspect ratios and fill their containing element.

Members

$inject

Methods

imageCover (scope, element, attrs)

Link function responsible for registering event listeners for image load and page resize. Depends on the page width being stored and updated via the rootScope. Also cleans up when directive is destroyed. Assumes HTML is organized similar to the following example:

{{i['mhs:button'] || 'Learn More'}} appears over link image on mouse over.
Parameters:
NameTypeDescription
scope

an AngularJS scope object.

element

the jqLite-wrapped element that this directive matches.

attrs

a hash object with key-value pairs of normalized attribute names their corresponding attribute values.

setImageClass

Helper function which adds a class to the image based on its dimensions.