Last active
December 10, 2024 20:13
-
-
Save kevduc/1eb7207b47bc731d56043ca89482b432 to your computer and use it in GitHub Desktop.
Simple Web Screen Reader v1
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
document.addEventListener("click", ({ target }) => { | |
speechSynthesis.cancel(); | |
speechSynthesis.speak(new SpeechSynthesisUtterance(target.textContent)); | |
// animate outline | |
target.animate({ | |
outline: [ | |
"2px solid rgb(0 0 255 / 100%)", | |
"5px solid rgb(0 0 255 / 0%)", | |
], | |
easing: "ease-out", | |
}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment