Skip to content

Commit

Permalink
fix: embed video in video tag (#635)
Browse files Browse the repository at this point in the history
* fix: embed video in video tag

* link to example
  • Loading branch information
domoritz authored Dec 17, 2024
1 parent 74e8779 commit f516733
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
44 changes: 44 additions & 0 deletions docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script setup>
import DefaultTheme from "vitepress/theme";
</script>

<template>
<DefaultTheme.Layout>
<template #home-hero-image>
<a href="./examples/flights-10m.html">
<video autoplay loop muted src="/demo-dark.mp4" class="video dark" />
<video autoplay loop muted src="/demo-light.mp4" class="video light" />
</a>
</template>
</DefaultTheme.Layout>
</template>

<style scoped>
.video {
position: absolute;
top: 50%;
left: 50%;
transform:translate(-50%, -50%);
max-height: 190px;
}
html:not(.dark) .video.dark {
display:none
}
.dark .video.light {
display:none
}
@media (min-width: 640px) {
.video {
max-height: 256px;
}
}
@media (min-width: 960px) {
.video {
max-height: 320px;
}
}
</style>
2 changes: 2 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import DefaultTheme from 'vitepress/theme';
import Example from './Example.vue';
import Layout from "./Layout.vue";
import './custom.css';

export default {
extends: DefaultTheme,
Layout: Layout,
enhanceApp(ctx) {
ctx.app.component('Example', Example);
}
Expand Down
4 changes: 0 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ hero:
Scalable, interactive data visualization
tagline: |
Mosaic is an extensible framework for linking databases and interactive views.
image:
dark: /demo-dark.mp4
light: /demo-light.mp4
alt: Mosaic visualizing flight data
actions:
- theme: brand
text: What is Mosaic?
Expand Down

0 comments on commit f516733

Please sign in to comment.