diff options
author | Matt Banks <mjbanks@gmail.com> | 2013-08-09 09:20:58 -0700 |
---|---|---|
committer | Matt Banks <mjbanks@gmail.com> | 2013-08-09 09:20:58 -0700 |
commit | 473254277ff2cdd623a0a06025d0e6b0a33a2c4d (patch) | |
tree | c6f11198dafdbc06322e57a5bc4746c0e35feb9d | |
parent | 7d6e51bfb2662426ec85b0fb1015e3dc8ce2e18d (diff) | |
parent | 1d83b08855261529298a88a98ad0caf334097b99 (diff) | |
download | jQuery.equalHeights-473254277ff2cdd623a0a06025d0e6b0a33a2c4d.zip jQuery.equalHeights-473254277ff2cdd623a0a06025d0e6b0a33a2c4d.tar.gz jQuery.equalHeights-473254277ff2cdd623a0a06025d0e6b0a33a2c4d.tar.bz2 |
Merge pull request #4 from conception-focus/master
Updated version number and better way to handle auto-initialization
-rw-r--r-- | jquery.equalheights.js | 10 | ||||
-rw-r--r-- | jquery.equalheights.min.js | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/jquery.equalheights.js b/jquery.equalheights.js index 9267419..17f6b73 100644 --- a/jquery.equalheights.js +++ b/jquery.equalheights.js @@ -6,7 +6,7 @@ * Uses the same license as jQuery, see: * http://docs.jquery.com/License * - * @version 1.3 + * @version 1.4 */ (function($) { @@ -24,8 +24,10 @@ }; // auto-initialize plugin - var target = $('[data-heights="equal"]').attr('data-targets'), - init = '[data-heights="equal"] ' + target; - $(init).equalHeights(); + $('[data-heights="equal"]').each(function(){ + var $this = $(this), + target = $this.data('targets'); + $this.find(target).equalHeights(); + }); })(jQuery); diff --git a/jquery.equalheights.min.js b/jquery.equalheights.min.js index 660349e..7b40b88 100644 --- a/jquery.equalheights.min.js +++ b/jquery.equalheights.min.js @@ -6,6 +6,6 @@ * Uses the same license as jQuery, see: * http://docs.jquery.com/License * - * @version 1.3 + * @version 1.4 */ -(function($){$.fn.equalHeights=function(){var maxHeight=0,$this=$(this);$this.each(function(){var height=$(this).innerHeight();if(height>maxHeight){maxHeight=height}});return $this.height(maxHeight)};var target=$('[data-heights="equal"]').attr('data-targets'),init='[data-heights="equal"] '+target;$(init).equalHeights()})(jQuery); +(function(e){e.fn.equalHeights=function(){var t=0,n=e(this);n.each(function(){var n=e(this).innerHeight();if(n>t){t=n}});return n.height(t)};e('[data-heights="equal"]').each(function(){var t=e(this),n=t.data("targets");t.find(n).equalHeights()})})(jQuery) |