Skip to content

Commit 22b74da

Browse files
committed
fixed IE8 window resize event loop bug
1 parent 702eea6 commit 22b74da

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

jquery.matchHeight.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,20 @@
121121

122122
$.fn.matchHeight._groups = [];
123123

124-
$.fn.matchHeight._update = function() {
124+
var previousResizeWidth = -1;
125+
126+
$.fn.matchHeight._update = function(event) {
127+
128+
// prevent update if fired from a resize event
129+
// where the viewport width hasn't actually changed
130+
// fixes an event looping bug in IE8
131+
if (event && event.type === 'resize') {
132+
var windowWidth = $(window).width();
133+
if (windowWidth === previousResizeWidth)
134+
return;
135+
previousResizeWidth = windowWidth;
136+
}
137+
125138
$.each($.fn.matchHeight._groups, function() {
126139
$.fn.matchHeight._apply(this.elements, this.byRow);
127140
});

0 commit comments

Comments
 (0)