Start a function after a user hasn't scrolled for 3 seconds.
I currently have a bid of code:
(simplified)
- $(function() {
- $(window).bind('scroll',function(event) {
- var scrollTop = $(window.scrollTop();
- if (scrollTop < 100) {
- $('#wrapper').removeClass.addClass("one");
- } else if (scrollTop >= 100 && scrollTop < 200) {
- $('#wrapper').removeClass.addClass("two");
- } // a few more else if but you get the general idea
- });
- });
Now I would like to perform
- function() {
- $('#header').append("<p>"+sometextvariable+"</p>");
- }
But I only need it to execute if the user hasn't scrolled for three seconds. I don't really have a clue how to go about this.
with kind regards,
Jeroen