Skip to content

Commit

Permalink
Added interval checking of scroll to not block all other events, whil…
Browse files Browse the repository at this point in the history
…e scrolling. Using pattern from: http://ejohn.org/blog/learning-from-twitter/
  • Loading branch information
eivindbekk committed Jan 2, 2012
1 parent e78bc61 commit c6e4d05
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions js/jquery.scrollorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,19 @@
}

$("body").prepend("<div id='scroll-wrap'></div>");
$(window).scroll(onScrollorama);

var didScroll = false;
$(window).scroll(function(){
didScroll = true;
});
setInterval(function(){
if(didScroll){
onScrollorama();
didScroll = false;
}
}, 50);


};

function onScrollorama() {
Expand Down Expand Up @@ -193,7 +205,7 @@
}
}

// add each animation to the blockÕs animations array
// add each animation to the block�s animations array
for (i=1; i<arguments.length; i++) {

var anim = arguments[i];
Expand Down

0 comments on commit c6e4d05

Please sign in to comment.