2
変数シークバーで 'change'と 'input'イベントリスナーの両方を使用するように、以下のコードをセットアップしました。ご覧のとおり、これらは重複しているので、2つのイベントリスナーを1つの関数にマージする方法が不思議です。複数のイベントリスナー?
// Event listener for the seek bar
seekBar.addEventListener("change", function() {
// Calculate the new time
var time = video.duration * (seekBar.value/100);
// Update the video time
video.currentTime = time;
});
// Event listener for the seek bar
seekBar.addEventListener("input", function() {
// Calculate the new time
var time = video.duration * (seekBar.value/100);
// Update the video time
video.currentTime = time;
});
[同じ関数にバインド複数のイベント]の可能な重複(https://stackoverflow.com/questions/17425311/bind-multiple-events-to-same-function) –