diff options
author | Brian Cully <bjc@spork.org> | 2025-03-10 13:13:30 -0400 |
---|---|---|
committer | Brian Cully <bjc@spork.org> | 2025-03-10 13:13:30 -0400 |
commit | cd16583ae449366f376e32c5825ec3cafea4c1b3 (patch) | |
tree | 6e6c6579feeab6212fd89e348cec90fbfd491a05 | |
parent | 5b2bade3f0f1cabc3b528e3d16954b863bb01cc3 (diff) | |
download | chords-cd16583ae449366f376e32c5825ec3cafea4c1b3.tar.gz chords-cd16583ae449366f376e32c5825ec3cafea4c1b3.zip |
add hover class to note list
-rw-r--r-- | key-picker.mjs | 8 |
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'); }) |