Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Debounce: search input (fire after user stops typing) let debounceTimer; $("#search").on("input", function() { clearTimeout(debounceTimer); debounceTimer = setTimeout(() => { doSearch($(this).val()); }, 300); }); // Throttle: scroll/resize handler (fire at most once per 100ms) let lastScroll = 0; $(window).on("scroll", function() { if (Date.now() - lastScroll > 100) { lastScroll = Date.now(); updateStickyNav($(this).scrollTop()); } });
Result
Open