summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-03-10 13:13:30 -0400
committerBrian Cully <bjc@spork.org>2025-03-10 13:13:30 -0400
commitcd16583ae449366f376e32c5825ec3cafea4c1b3 (patch)
tree6e6c6579feeab6212fd89e348cec90fbfd491a05
parent5b2bade3f0f1cabc3b528e3d16954b863bb01cc3 (diff)
downloadchords-cd16583ae449366f376e32c5825ec3cafea4c1b3.tar.gz
chords-cd16583ae449366f376e32c5825ec3cafea4c1b3.zip
add hover class to note list
-rw-r--r--key-picker.mjs8
1 files changed, 6 insertions, 2 deletions
diff --git a/key-picker.mjs b/key-picker.mjs
index c4fe7ce..fe344ae 100644
--- a/key-picker.mjs
+++ b/key-picker.mjs
@@ -12,17 +12,21 @@ function scaleFrom(tonic, scale) {
}
function handleNoteEnter(e) {
- const n = Note.fromString(e.target.innerText).toString();
+ const elt = e.target;
+ const n = Note.fromString(elt.innerText).toString();
// todo: this should be delegated. the key selector shouldn't know
// about the fretboard at all.
+ elt.classList.add('hover');
document.querySelectorAll(`#fretboard [x-data-note="${n}"]`).forEach(elt => {
elt.classList.add('hover');
})
}
function handleNoteLeave(e) {
- const n = Note.fromString(e.target.innerText).toString();
+ const elt = e.target;
+ const n = Note.fromString(elt.innerText).toString();
// ibid.
+ elt.classList.remove('hover');
document.querySelectorAll(`#fretboard [x-data-note="${n}"]`).forEach(elt => {
elt.classList.remove('hover');
})