File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
apps/website/src/sections Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ import PlayButton from "../assets/videos/play-button.svg";
44
44
margin-inline: var(--spacing-xl);
45
45
}
46
46
47
+ .video-not-interactive {
48
+ pointer-events: none;
49
+ }
50
+
47
51
video::-webkit-media-controls-panel {
48
52
background-image: none;
49
53
filter: brightness(0.2);
@@ -57,6 +61,11 @@ import PlayButton from "../assets/videos/play-button.svg";
57
61
top: 50%;
58
62
left: 50%;
59
63
transform: translate(-50%, -50%);
64
+ visibility: visible;
65
+ }
66
+
67
+ .playButton-invisible {
68
+ visibility: hidden;
60
69
}
61
70
62
71
.playButton :hover {
@@ -99,20 +108,20 @@ import PlayButton from "../assets/videos/play-button.svg";
99
108
const myButton = document.getElementsByClassName("playButton")[0] as HTMLButtonElement;
100
109
let isPlaying = false;
101
110
102
- video.style.pointerEvents = "none" ;
111
+ video.classList.add("video-not-interactive") ;
103
112
104
113
myButton.addEventListener("click", () => {
105
114
video.play();
106
115
isPlaying = true;
107
- myButton.style.visibility = "hidden" ;
108
- video.style.pointerEvents = "auto" ;
116
+ myButton.classList.add("playButton-invisible") ;
117
+ video.classList.remove("video-not-interactive") ;
109
118
});
110
119
111
120
video.addEventListener("pause", () => {
112
121
if (isPlaying) {
113
122
isPlaying = false;
114
- myButton.style.visibility = "visible" ;
115
- video.style.pointerEvents = "none" ;
123
+ myButton.classList.remove("playButton-invisible") ;
124
+ video.classList.add("video-not-interactive") ;
116
125
}
117
126
});
118
127
});
You can’t perform that action at this time.
0 commit comments