diff options
author | liabru <liabru@brm.io> | 2014-10-16 18:48:54 +0100 |
---|---|---|
committer | liabru <liabru@brm.io> | 2014-10-16 18:48:54 +0100 |
commit | 0b31e21ad88a6078896e22c4bfdab72f32fb82a2 (patch) | |
tree | 4ccddf7e36d76907818cb74855bd033cbdc67831 /jquery.matchHeight.js | |
parent | 57ee64a333353bbaf1827d545bbdb73a9d698f79 (diff) | |
download | jquery-match-height-0b31e21ad88a6078896e22c4bfdab72f32fb82a2.zip jquery-match-height-0b31e21ad88a6078896e22c4bfdab72f32fb82a2.tar.gz jquery-match-height-0b31e21ad88a6078896e22c4bfdab72f32fb82a2.tar.bz2 |
added update callback events
Diffstat (limited to 'jquery.matchHeight.js')
-rw-r--r-- | jquery.matchHeight.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js index 12d6743..d0679c5 100644 --- a/jquery.matchHeight.js +++ b/jquery.matchHeight.js @@ -109,6 +109,8 @@ $.fn.matchHeight._groups = []; $.fn.matchHeight._throttle = 80; $.fn.matchHeight._maintainScroll = false; + $.fn.matchHeight._beforeUpdate = null; + $.fn.matchHeight._afterUpdate = null; /* * $.fn.matchHeight._apply @@ -242,10 +244,16 @@ * updates matchHeight on all current groups with their correct options */ - var _update = function() { + var _update = function(event) { + if ($.fn.matchHeight._beforeUpdate) + $.fn.matchHeight._beforeUpdate(event, $.fn.matchHeight._groups); + $.each($.fn.matchHeight._groups, function() { $.fn.matchHeight._apply(this.elements, this.byRow); }); + + if ($.fn.matchHeight._afterUpdate) + $.fn.matchHeight._afterUpdate(event, $.fn.matchHeight._groups); }; $.fn.matchHeight._update = function(throttle, event) { @@ -261,10 +269,10 @@ // throttle updates if (!throttle) { - _update(); + _update(event); } else if (_updateTimeout === -1) { _updateTimeout = setTimeout(function() { - _update(); + _update(event); _updateTimeout = -1; }, $.fn.matchHeight._throttle); } @@ -279,7 +287,7 @@ // update heights on load and resize events $(window).bind('load', function(event) { - $.fn.matchHeight._update(); + $.fn.matchHeight._update(false, event); }); // throttled update heights on resize events |