diff options
Diffstat (limited to 'jquery.equalheights.js')
-rw-r--r-- | jquery.equalheights.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/jquery.equalheights.js b/jquery.equalheights.js index f21303c..560fd64 100644 --- a/jquery.equalheights.js +++ b/jquery.equalheights.js @@ -10,17 +10,21 @@ */ (function($) { - $.fn.equalHeights = function() { - var maxHeight = 0, + $.fn.equalHeights = function() { + var maxHeight = 0, $this = $(this); - $this.each( function() { - var height = $(this).innerHeight(); + $this.each( function() { + var height = $(this).innerHeight(); - if ( height > maxHeight ) { maxHeight = height; } - }); + if ( height > maxHeight ) { maxHeight = height; } + }); - return $this.height(maxHeight); - }; + return $this.height(maxHeight); + }; + + // auto-initialize plugin + var target = $('[data-heights="equal"]').attr('data-targets'), init = '[data-heights="equal"] ' + target; + $(init).equalHeights(); })(jQuery); |