Skip to content

Commit

Permalink
Merge pull request #56 from hyperaudio/55-class-active-remove
Browse files Browse the repository at this point in the history
55 class active remove (addresses #55)
  • Loading branch information
maboa authored Aug 17, 2021
2 parents 535016c + e924c2f commit c096822
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/hyperaudio-lite.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*! (C) The Hyperaudio Project. MIT @license: en.wikipedia.org/wiki/MIT_License. */
/*! Version 2.0.0 */
/*! Version 2.0.1 */

'use strict';

Expand Down Expand Up @@ -246,6 +246,13 @@ class HyperaudioLite {

setPlayHead = e => {
const target = e.target ? e.target : e.srcElement;

let activeElements = Array.from(this.transcript.getElementsByClassName('active'));

activeElements.forEach(e => {
e.classList.remove('active');
});

target.setAttribute('class', 'active');
const timeSecs = parseInt(target.getAttribute('data-m')) / 1000;

Expand Down

0 comments on commit c096822

Please sign in to comment.