From 290dfcf7fb10382348007cac78871e3e85e46f8e Mon Sep 17 00:00:00 2001 From: liabru Date: Tue, 31 Mar 2015 01:31:25 +0100 Subject: [PATCH] fix typo in target option, closes #63 --- jquery.matchHeight-min.js | 12 ++++++------ jquery.matchHeight.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jquery.matchHeight-min.js b/jquery.matchHeight-min.js index 599cd36..f870d9a 100644 --- a/jquery.matchHeight-min.js +++ b/jquery.matchHeight-min.js @@ -3,9 +3,9 @@ * http://brm.io/jquery-match-height/ * License: MIT */ -(function(d){var n=-1,f=-1,g=function(a){return parseFloat(a)||0},r=function(a){var b=null,c=[];d(a).each(function(){var a=d(this),k=a.offset().top-g(a.css("margin-top")),l=0=Math.floor(Math.abs(b-k))?c[c.length-1]=l.add(a):c.push(a);b=k});return c},p=function(a){var b={byRow:!0,property:"height",target:null,remove:!1};if("object"===typeof a)return d.extend(b,a);"boolean"===typeof a?b.byRow=a:"remove"===a&&(b.remove=!0);return b},b=d.fn.matchHeight= -function(a){var e=p(a);if(e.remove){var c=this;this.css(e.property,"");d.each(b._groups,function(a,b){b.elements=b.elements.not(c)});return this}if(1>=this.length&&!a.target)return this;b._groups.push({elements:this,options:e});b._apply(this,e);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,e){var c=p(e),h=d(a),k=[h],l=d(window).scrollTop(),f=d("html").outerHeight(!0),m=h.parents().filter(":hidden");m.each(function(){var a= -d(this);a.data("style-cache",a.attr("style"))});m.css("display","block");c.byRow&&!c.target&&(h.each(function(){var a=d(this),b="inline-block"===a.css("display")?"inline-block":"block";a.data("style-cache",a.attr("style"));a.css({display:b,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),k=r(h),h.each(function(){var a=d(this);a.attr("style",a.data("style-cache")||"")}));d.each(k,function(a,b){var e=d(b), -f=0;if(c.target)f=c.target.outerHeight(!1);else{if(c.byRow&&1>=e.length){e.css(c.property,"");return}e.each(function(){var a=d(this),b={display:"inline-block"===a.css("display")?"inline-block":"block"};b[c.property]="";a.css(b);a.outerHeight(!1)>f&&(f=a.outerHeight(!1));a.css("display","")})}e.each(function(){var a=d(this),b=0;a.is(c.target)||("border-box"!==a.css("box-sizing")&&(b+=g(a.css("border-top-width"))+g(a.css("border-bottom-width")),b+=g(a.css("padding-top"))+g(a.css("padding-bottom"))), -a.css(c.property,f-b))})});m.each(function(){var a=d(this);a.attr("style",a.data("style-cache")||null)});b._maintainScroll&&d(window).scrollTop(l/f*d("html").outerHeight(!0));return this};b._applyDataApi=function(){var a={};d("[data-match-height], [data-mh]").each(function(){var b=d(this),c=b.attr("data-mh")||b.attr("data-match-height");a[c]=c in a?a[c].add(b):b});d.each(a,function(){this.matchHeight(!0)})};var q=function(a){b._beforeUpdate&&b._beforeUpdate(a,b._groups);d.each(b._groups,function(){b._apply(this.elements, -this.options)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,e){if(e&&"resize"===e.type){var c=d(window).width();if(c===n)return;n=c}a?-1===f&&(f=setTimeout(function(){q(e);f=-1},b._throttle)):q(e)};d(b._applyDataApi);d(window).bind("load",function(a){b._update(!1,a)});d(window).bind("resize orientationchange",function(a){b._update(!0,a)})})(jQuery); \ No newline at end of file +(function(c){var n=-1,f=-1,g=function(a){return parseFloat(a)||0},r=function(a){var b=null,d=[];c(a).each(function(){var a=c(this),k=a.offset().top-g(a.css("margin-top")),l=0=Math.floor(Math.abs(b-k))?d[d.length-1]=l.add(a):d.push(a);b=k});return d},p=function(a){var b={byRow:!0,property:"height",target:null,remove:!1};if("object"===typeof a)return c.extend(b,a);"boolean"===typeof a?b.byRow=a:"remove"===a&&(b.remove=!0);return b},b=c.fn.matchHeight= +function(a){a=p(a);if(a.remove){var e=this;this.css(a.property,"");c.each(b._groups,function(a,b){b.elements=b.elements.not(e)});return this}if(1>=this.length&&!a.target)return this;b._groups.push({elements:this,options:a});b._apply(this,a);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,e){var d=p(e),h=c(a),k=[h],l=c(window).scrollTop(),f=c("html").outerHeight(!0),m=h.parents().filter(":hidden");m.each(function(){var a=c(this); +a.data("style-cache",a.attr("style"))});m.css("display","block");d.byRow&&!d.target&&(h.each(function(){var a=c(this),b="inline-block"===a.css("display")?"inline-block":"block";a.data("style-cache",a.attr("style"));a.css({display:b,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),k=r(h),h.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||"")}));c.each(k,function(a,b){var e=c(b),f=0;if(d.target)f= +d.target.outerHeight(!1);else{if(d.byRow&&1>=e.length){e.css(d.property,"");return}e.each(function(){var a=c(this),b={display:"inline-block"===a.css("display")?"inline-block":"block"};b[d.property]="";a.css(b);a.outerHeight(!1)>f&&(f=a.outerHeight(!1));a.css("display","")})}e.each(function(){var a=c(this),b=0;a.is(d.target)||("border-box"!==a.css("box-sizing")&&(b+=g(a.css("border-top-width"))+g(a.css("border-bottom-width")),b+=g(a.css("padding-top"))+g(a.css("padding-bottom"))),a.css(d.property, +f-b))})});m.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||null)});b._maintainScroll&&c(window).scrollTop(l/f*c("html").outerHeight(!0));return this};b._applyDataApi=function(){var a={};c("[data-match-height], [data-mh]").each(function(){var b=c(this),d=b.attr("data-mh")||b.attr("data-match-height");a[d]=d in a?a[d].add(b):b});c.each(a,function(){this.matchHeight(!0)})};var q=function(a){b._beforeUpdate&&b._beforeUpdate(a,b._groups);c.each(b._groups,function(){b._apply(this.elements, +this.options)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,e){if(e&&"resize"===e.type){var d=c(window).width();if(d===n)return;n=d}a?-1===f&&(f=setTimeout(function(){q(e);f=-1},b._throttle)):q(e)};c(b._applyDataApi);c(window).bind("load",function(a){b._update(!1,a)});c(window).bind("resize orientationchange",function(a){b._update(!0,a)})})(jQuery); \ No newline at end of file diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js index 25d0e6a..552cf5f 100644 --- a/jquery.matchHeight.js +++ b/jquery.matchHeight.js @@ -111,7 +111,7 @@ return this; } - if (this.length <= 1 && !options.target) { + if (this.length <= 1 && !opts.target) { return this; }