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
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user