Files
simongehrig 787bd61ce6 SCSS Framework
Added modernizr script to image Cover example
Added Aspect Ratio variables
Fixed image->fit aspect ratio to w/h instead of h/w
Added impotrant to width/height in image ->cover

TODO vertical center mixin
2017-05-03 10:00:51 +02:00

25 lines
605 B
JavaScript

/**
* Created by Simon on 28.04.2017.
*/
function modernizeObjectFit($selector) {
// Object-fit
if (!Modernizr.objectfit) {
jQuery($selector).each(function () {
var $container = jQuery(this),
imgUrl = $container.find('img').prop('src');
if (imgUrl) {
$container
.css('backgroundImage', 'url(' + imgUrl + ')')
.addClass('compat-object-fit');
}
});
jQuery($selector + " img").each(function () {
jQuery(this).css('opacity', '0');
});
}
}