Skip to content

Commit

Permalink
Fix for maximum callstack errors when not visible.
Browse files Browse the repository at this point in the history
  • Loading branch information
shshaw committed Mar 3, 2016
1 parent c99322f commit 3ba4b54
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-flipster",
"version": "1.1.0",
"version": "1.1.1",
"homepage": "https://github.com/drien/jquery-flipster",
"authors": [
"Adrien Delessert <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.flipster.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.flipster",
"version": "1.1.0",
"version": "1.1.1",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-less": "~1.0.1",
Expand Down
10 changes: 10 additions & 0 deletions src/jquery.flipster.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@

_container,
_containerWidth,
_resizeInterval,

_items,
_itemOffsets = [],
Expand Down Expand Up @@ -331,6 +332,15 @@
_containerWidth = _container.width();
_container.height(calculateBiggestItemHeight());

// Prevent maximum callstack error. #79 #74
if ( !_containerWidth ) {
_resizeInterval = _resizeInterval || setInterval(function(){ resize(skipTransition); },500);
return;
} else if ( _resizeInterval ) {
clearInterval(_resizeInterval);
_resizeInterval = false;
}

_items.each(function(i) {
var item = $(this),
width,
Expand Down

0 comments on commit 3ba4b54

Please sign in to comment.