Last active
July 29, 2016 07:30
-
-
Save killerbytes/11167446 to your computer and use it in GitHub Desktop.
This file contains 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 characters
var delay = (function() { | |
var timer = 0; | |
return function(callback, ms) { | |
clearTimeout(timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); | |
$(window).resize(delay(function() { | |
someFunction().... | |
}, 500)); | |
if (timer){ | |
clearTimeout(timer); | |
} | |
timer = setTimeout(function(){ | |
$.post("remote.php",{'partial':this.value},function(data){ | |
$("#gen_results").html(data); | |
}); | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment