mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-28 09:42:55 +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");
|
var c = document.getElementById("c");
|
||||||
c.ondblclick = toggleFullScreen;
|
c.ondblclick = toggleFullScreen;
|
||||||
c.onclick = function () {
|
video_selector.onclick = function (e) {
|
||||||
// can't togglePlayPause here, choice buttons stop the video
|
togglePlayPause();
|
||||||
// should use preventdefault or something
|
e.preventDefault();
|
||||||
// use spacebar for now
|
|
||||||
// mind that autoplay is disabled in latest chrome, so play after click
|
|
||||||
document.getElementById("video").play();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
document.onkeypress = function (e) {
|
document.onkeypress = function (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue