Last active
July 5, 2016 06:34
Revisions
-
Samjin renamed this gist
Jul 5, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Samjin revised this gist
Mar 24, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,4 +21,4 @@ $(window).scroll(throttle(function() { }, 250)); https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/window-scroll-event.html -
Samjin created this gist
Mar 24, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ var throttle = (function () { return function (fn, delay) { delay || (delay = 100); var last = +new Date; return function () { var now = +new Date; if (now - last > delay) { fn.apply(this, arguments); last = now; } }; }; })(); And then it can be used like this: var outerPane = $details.find(".details-pane-outer"), $(window).scroll(throttle(function() { // Check your page position and then // Load in more results }, 250)); http://ejohn.org/blog/learning-from-twitter/#postcomment