Skip to content

Commit

Permalink
fixed IE8 window resize event loop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Apr 15, 2014
1 parent 702eea6 commit 22b74da
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion jquery.matchHeight.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,20 @@

$.fn.matchHeight._groups = [];

$.fn.matchHeight._update = function() {
var previousResizeWidth = -1;

$.fn.matchHeight._update = function(event) {

// prevent update if fired from a resize event
// where the viewport width hasn't actually changed
// fixes an event looping bug in IE8
if (event && event.type === 'resize') {
var windowWidth = $(window).width();
if (windowWidth === previousResizeWidth)
return;
previousResizeWidth = windowWidth;
}

$.each($.fn.matchHeight._groups, function() {
$.fn.matchHeight._apply(this.elements, this.byRow);
});
Expand Down

0 comments on commit 22b74da

Please sign in to comment.