summaryrefslogtreecommitdiffstats
path: root/jquery.matchHeight.js
diff options
context:
space:
mode:
authorliabru <liabru@brm.io>2014-10-16 18:48:54 +0100
committerliabru <liabru@brm.io>2014-10-16 18:48:54 +0100
commit0b31e21ad88a6078896e22c4bfdab72f32fb82a2 (patch)
tree4ccddf7e36d76907818cb74855bd033cbdc67831 /jquery.matchHeight.js
parent57ee64a333353bbaf1827d545bbdb73a9d698f79 (diff)
downloadjquery-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.js16
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