forked from snxraven/ravenscott-blog
readd auto search
This commit is contained in:
parent
05302c3b04
commit
8f5e21119d
@ -101,5 +101,22 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script>
|
||||||
|
let typingTimer; // Timer identifier
|
||||||
|
const doneTypingInterval = 500; // Time in ms, adjust for desired delay
|
||||||
|
|
||||||
|
const searchInput = document.getElementById('search-input');
|
||||||
|
|
||||||
|
searchInput.addEventListener('input', function() {
|
||||||
|
clearTimeout(typingTimer);
|
||||||
|
typingTimer = setTimeout(function() {
|
||||||
|
searchInput.form.submit();
|
||||||
|
}, doneTypingInterval);
|
||||||
|
});
|
||||||
|
|
||||||
|
searchInput.addEventListener('keydown', function() {
|
||||||
|
clearTimeout(typingTimer);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user