Comparing version 0.4.0 to 0.4.1
/** | ||
* @preserve fitobject - v0.4.0 - 2017-05-11 | ||
* @preserve fitobject - v0.4.1 - 2017-05-11 | ||
* Size and position an object to fit its container. | ||
@@ -51,3 +51,3 @@ * https://github.com/dannydb/fitobject | ||
if ($object.data('object-fit')) { | ||
options['fit'] = $object.data('fit'); | ||
options['fit'] = $object.data('object-fit'); | ||
} | ||
@@ -54,0 +54,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=i(require("jquery")):t.fitObject=i(t.jQuery)}(this,function(t){var i=function(i){t(this).each(function(h,o){var a=t(this),r=null,l=null,f=null,c=null,d={},s={},u={},p=null,w={container:null,fit:"cover",safeArea:{top:0,right:0,bottom:0,left:0}};l=a.parents(".fit-object-wrapper"),a.data("safe-area")&&(w.safeArea=a.data("safe-area")),a.data("object-fit")&&(w.fit=a.data("fit")),a.data("fit-container")&&(w.container=a.data("fit-container")),i&&(w=t.extend(w,i)),(r=0===l.length&&null===w.container?a.parent():null===w.container?l.parent():t(w.container)).css({display:"block",visibility:"visible"}),c=(f=a.innerHeight()/a.width())<r.height()/r.width(),d.height=r.width()*f,d.width=r.height()/f,u.x=d.width-r.width(),u.y=d.height-r.height(),s.x=(r.width()-d.width)/2,s.y=(r.height()-d.height)/2,"cover"===w.fit&&c&&(p={height:r.height(),width:d.width,left:n("horizontal",s.x,u.x,w),top:0}),"cover"!==w.fit||c||(p={height:d.height,width:r.width(),left:0,top:n("vertical",s.y,u.y,w)}),"contain"===w.fit&&c&&(p={height:d.height,width:r.width(),left:0,top:s.y}),"contain"!==w.fit||c||(p={height:r.height(),width:d.width,left:s.x,top:0}),r.attr("style",null),e(a,l,r,p)})},e=function(i,e,n,h){t.extend(h,{position:"absolute"}),e.length<1?((e=t('<div class="fit-object-wrapper"></div>')).css(h),i.wrap(e)):e.css(h),"static"===n.css("position")&&n.css("position","relative"),"hidden"!==n.css("overflow")&&n.css("overflow","hidden")},n=function(t,i,e,n){var h=n.safeArea,o=(h.bottom-h.top)/100,a=(h.right-h.left)/100;return"horizontal"===t&&(i+=e*a),"vertical"===t&&(i+=e*o),i>0&&(i=0),i<-e&&(i=-e),i};t.fn.fitObject=i}); | ||
!function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=i(require("jquery")):t.fitObject=i(t.jQuery)}(this,function(t){var i=function(i){t(this).each(function(h,o){var a=t(this),r=null,l=null,f=null,c=null,d={},s={},u={},p=null,w={container:null,fit:"cover",safeArea:{top:0,right:0,bottom:0,left:0}};l=a.parents(".fit-object-wrapper"),a.data("safe-area")&&(w.safeArea=a.data("safe-area")),a.data("object-fit")&&(w.fit=a.data("object-fit")),a.data("fit-container")&&(w.container=a.data("fit-container")),i&&(w=t.extend(w,i)),(r=0===l.length&&null===w.container?a.parent():null===w.container?l.parent():t(w.container)).css({display:"block",visibility:"visible"}),c=(f=a.innerHeight()/a.width())<r.height()/r.width(),d.height=r.width()*f,d.width=r.height()/f,u.x=d.width-r.width(),u.y=d.height-r.height(),s.x=(r.width()-d.width)/2,s.y=(r.height()-d.height)/2,"cover"===w.fit&&c&&(p={height:r.height(),width:d.width,left:n("horizontal",s.x,u.x,w),top:0}),"cover"!==w.fit||c||(p={height:d.height,width:r.width(),left:0,top:n("vertical",s.y,u.y,w)}),"contain"===w.fit&&c&&(p={height:d.height,width:r.width(),left:0,top:s.y}),"contain"!==w.fit||c||(p={height:r.height(),width:d.width,left:s.x,top:0}),r.attr("style",null),e(a,l,r,p)})},e=function(i,e,n,h){t.extend(h,{position:"absolute"}),e.length<1?((e=t('<div class="fit-object-wrapper"></div>')).css(h),i.wrap(e)):e.css(h),"static"===n.css("position")&&n.css("position","relative"),"hidden"!==n.css("overflow")&&n.css("overflow","hidden")},n=function(t,i,e,n){var h=n.safeArea,o=(h.bottom-h.top)/100,a=(h.right-h.left)/100;return"horizontal"===t&&(i+=e*a),"vertical"===t&&(i+=e*o),i>0&&(i=0),i<-e&&(i=-e),i};t.fn.fitObject=i}); |
{ | ||
"name": "fitobject", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Fit an object to its container.", | ||
@@ -5,0 +5,0 @@ "main": "fitobject.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12205