Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

feat: experimental video width transition

Christian Fei2713693a14c1
diff --git a/client/components/video-element.js b/client/components/video-element.js
index c72fcb6..dc743ec 100644
--- a/client/components/video-element.js
+++ b/client/components/video-element.js
@@ -184,6 +184,9 @@ class VideoElement extends HTMLElement {
this.classList.add('big')
this.pauseOtherVideos(video)
})
+ video.addEventListener('pause', () => {
+ this.classList.remove('big')
+ })
}
unregisterVideoEvents (video) {
video.removeEventListener('play', this.pauseOtherVideos.bind(this, video))
diff --git a/client/main.css b/client/main.css
index bb04660..78265ab 100644
--- a/client/main.css
+++ b/client/main.css
@@ -174,8 +174,10 @@ form {
}
-
-@media all and (min-width: 50em) {
+video-element, video-element video {
+ transition: width 0.2s ease-in;
+}
+@media all and (min-width: 60em) {
video-element.big {
width: 50%;
}
@@ -183,7 +185,7 @@ form {
width: 100%;
}
}
-@media all and (max-width: 50em) {
+@media all and (max-width: 60em) {
video-element.big {
width: 100%;
}