HTML and CSS Reference
In-Depth Information
window.onload = function() {
...
// Add an event listener for the pause button.
pauseBtn.addEventListener(“click", function(e) {
});
}
4.
Within the function block of this event listener, add a statement that will call the
pause()
method on the
video
variable.
// Add an event listener for the pause button.
pauseBtn.addEventListener(“click", function(e) {
// Pause the video.
video.pause();
});
5.
Save the
video.js
file.
Open the About page. You should see your new Pause button, as shown in Figure 11-5. Try playing the video and
then using the Pause button to pause playback. If the Pause button doesn't work, try using your browser's developer
tools to diagnose what is causing the problem.