Skip to content

Commit acdc512

Browse files
committed
Sticky video on "What Next for DuckDB"
- Video sticky on "What Next for DuckDB" post - Small design adjustments
1 parent 795eef6 commit acdc512

3 files changed

Lines changed: 51 additions & 5 deletions

File tree

_library/2026-08-26-what-next-for-duckdb.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ excerpt: ""
1111
pill: "Developer Voices by Kris Jenkins"
1212
---
1313

14-
<div class="video-container">
14+
<div class="video-container sticky">
1515
<iframe id="yt-player" width="560" height="315" src="https://www.youtube-nocookie.com/embed/C3l4CsP1Ak0?si=u_DMOqM7NgftcqOi&enablejsapi=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
1616
</div>
1717

@@ -38,7 +38,6 @@ pill: "Developer Voices by Kris Jenkins"
3838
ytPlayer.playVideo();
3939
}
4040
function seekYouTube(seconds) {
41-
document.getElementById('yt-player').scrollIntoView({ behavior: 'smooth', block: 'center' });
4241
if (ytReady) {
4342
doSeek(seconds);
4443
} else {
@@ -55,7 +54,8 @@ pill: "Developer Voices by Kris Jenkins"
5554
var a = document.createElement('a');
5655
a.href = '#';
5756
a.className = 'yt-seek';
58-
a.textContent = text;
57+
a.innerHTML = '<svg class="icon"><use href="#play"></use></svg>';
58+
a.appendChild(document.createTextNode(text.slice(1, -1)));
5959
a.title = 'Jump to ' + m[0].slice(1, -1) + ' in the video';
6060
a.addEventListener('click', function (e) {
6161
e.preventDefault();
@@ -65,9 +65,40 @@ pill: "Developer Voices by Kris Jenkins"
6565
p.appendChild(a);
6666
});
6767
});
68+
69+
document.addEventListener('click', function (e) {
70+
if (e.target.closest('svg.anchor-icon')) return;
71+
var a = e.target.closest('h2 > a[href^="#"], h3 > a[href^="#"], h4 > a[href^="#"]');
72+
if (!a) return;
73+
e.preventDefault();
74+
e.stopPropagation();
75+
history.replaceState(null, '', a.href);
76+
}, true);
6877
</script>
6978
<style>
70-
.yt-seek { font-family: monospace; }
79+
.newswrap .postwrap .postcontent h2 + p:has(> .yt-seek),
80+
.newswrap .postwrap .postcontent h3 + p:has(> .yt-seek),
81+
.newswrap .postwrap .postcontent h4 + p:has(> .yt-seek) {
82+
margin-top: 0;
83+
}
84+
.newswrap .postwrap .postcontent h2:has(+ p > .yt-seek),
85+
.newswrap .postwrap .postcontent h3:has(+ p > .yt-seek),
86+
.newswrap .postwrap .postcontent h4:has(+ p > .yt-seek) {
87+
margin-bottom: 6px;
88+
}
89+
.yt-seek {
90+
font-family: "JetBrainsMono-Bold", monospace;
91+
font-size: var(--type-code-large, 16px);
92+
text-decoration: none;
93+
}
94+
.yt-seek svg.icon {
95+
width: .9em;
96+
height: .9em;
97+
margin-right: .35em;
98+
vertical-align: -.1em;
99+
fill: currentColor;
100+
stroke: none;
101+
}
71102
</style>
72103

73104
|-------|-------|

_sass/pages/_blog.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,16 @@ h5 a {
728728
padding-top: 0;
729729
height: 0;
730730
overflow: hidden;
731+
&.sticky{
732+
position: sticky;
733+
top: 69px;
734+
z-index: 20;
735+
background: var(--main-body-background-color, #FAFAFA);
736+
box-shadow: 0 20px 20px -10px var(--main-body-background-color, #FAFAFA);
737+
@media only screen and (max-width: 660px){
738+
top: 53px;
739+
}
740+
}
731741
iframe, object, embed{
732742
position: absolute;
733743
top: 0;

js/script.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ $(document).ready(function(){
326326
.not('[href="#"]')
327327
.not('[href="#0"]')
328328
.click(function(event) {
329+
if (event.target.closest('svg.anchor-icon')) {
330+
return;
331+
}
329332
if ($(this).parent().hasClass('toc-entry')) {
330333
scrollspeed = 100;
331334
}
@@ -338,8 +341,10 @@ $(document).ready(function(){
338341

339342
if (target.length) {
340343
// event.preventDefault();
344+
var stickyVideo = document.querySelector('.video-container.sticky');
345+
var stickyOffset = stickyVideo ? stickyVideo.offsetHeight + 20 : 0;
341346
$('html, body').animate({
342-
scrollTop: target.offset().top - 90
347+
scrollTop: target.offset().top - 90 - stickyOffset
343348
}, scrollspeed);
344349
}
345350
}

0 commit comments

Comments
 (0)