Skip to content

Commit

Permalink
check for element on resize; Ref #38
Browse files Browse the repository at this point in the history
Possible fix for IE8, which triggers resize when body size changes.
See http://snook.ca/archives/javascript/ie6_fires_onresize
  • Loading branch information
desandro committed May 14, 2013
1 parent b74b853 commit 0546047
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "packery",
"version": "1.0.3",
"version": "1.0.4",
"author": "David DeSandro / Metafizzy",
"description": "bin-packing layout library",
"main": [
Expand Down
7 changes: 5 additions & 2 deletions js/packery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Packery v1.0.3
* Packery v1.0.4
* bin-packing layout library
* http://packery.metafizzy.co
*
Expand Down Expand Up @@ -612,7 +612,10 @@ Packery.prototype.onresize = function() {
Packery.prototype.resize = function() {
// don't trigger if size did not change
var size = getSize( this.element );
if ( size.innerWidth === this.elementSize.innerWidth ) {
// check that elementSize and size are there
// IE8 triggers resize on body size change, so they might not be
var hasSizes = this.elementSize && size;
if ( hasSizes && size.innerWidth === this.elementSize.innerWidth ) {
return;
}

Expand Down

0 comments on commit 0546047

Please sign in to comment.