mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-27 17:23:22 +00:00
assets/scripts.js: Pause and unpause on click
- By placing the event handler on the video element, we ensure we don't receive it when a choice item was clicked. - Use preventDefault to avoid the pause-and-immediately-unpause problem due to the video element itself also handling the event.
This commit is contained in:
parent
7989e92f2b
commit
336a65f31a
1 changed files with 3 additions and 6 deletions
|
@ -398,12 +398,9 @@ window.onload = function() {
|
|||
|
||||
var c = document.getElementById("c");
|
||||
c.ondblclick = toggleFullScreen;
|
||||
c.onclick = function () {
|
||||
// can't togglePlayPause here, choice buttons stop the video
|
||||
// should use preventdefault or something
|
||||
// use spacebar for now
|
||||
// mind that autoplay is disabled in latest chrome, so play after click
|
||||
document.getElementById("video").play();
|
||||
video_selector.onclick = function (e) {
|
||||
togglePlayPause();
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
document.onkeypress = function (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue