Skip to content

Commit

Permalink
Update index.htm
Browse files Browse the repository at this point in the history
  • Loading branch information
freealise authored Sep 27, 2024
1 parent 3836d45 commit 51a1028
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/basic/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<a href='#' onclick='snapshot();'>snapshot</a><br/>
<img src='' id='img_out' onload='var ctxt = document.getElementById("cnv_out").getContext("2d");ctxt.drawImage(this, 0, 0);'/><br/>
<canvas id='cnv_out'></canvas>
<div id='subs_c'><textarea id="times"></textarea><textarea id="subs">line0
<div id='subs_c'><textarea id="times" onscroll="scrollSubs(true);"></textarea><textarea id="subs" onscroll="scrollSubs(false);">line0

line1

Expand Down Expand Up @@ -769,6 +769,14 @@
subs_link.download = 'subtitles.vtt';
subs_link.click();
}

function scrollSubs(s) {
if (s === true) {
subs.scrollTo(0, times.scrollTop);
} else {
times.scrollTo(0, subs.scrollTop);
}
}

</script>
</body>
Expand Down

0 comments on commit 51a1028

Please sign in to comment.