fix(article): video iframe margin

This commit is contained in:
Jimmy Cai 2021-03-07 12:48:03 +01:00
parent b10a0ab002
commit 684bbfd8af
No known key found for this signature in database
GPG Key ID: 3EA408E527F37B18
4 changed files with 31 additions and 9 deletions

View File

@ -300,12 +300,31 @@
color: var(--card-text-color-main);
}
.video-wrapper {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
overflow: hidden;
& > iframe {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
}
/// Negative margins
blockquote,
figure,
.gallery,
pre {
pre,
.video-wrapper,
.s_video_simple {
margin-left: calc((var(--card-padding)) * -1);
margin-right: calc((var(--card-padding)) * -1);
width: calc(100% + var(--card-padding) * 2);
}
}

View File

@ -12,13 +12,12 @@
<p>当前视频av或BV号{{ $vid }}视频分P{{ $videopage }}</p>
{{ end }}
<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
<div class="video-wrapper">
<iframe src="//player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"
>
</iframe>
</div>

View File

@ -1,10 +1,10 @@
{{ $vid := .Get 0 }}
<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
<div class="video-wrapper">
<iframe src="http://v.qq.com/txp/iframe/player.html?vid={{ $vid }}&auto=0"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
style="position: absolute; width: 100%; height: 100%;">
allowfullscreen="true"
>
</iframe>
</div>

View File

@ -2,8 +2,12 @@
{{- if not $pc.Disable -}}
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
{{- $id := .Get "id" | default (.Get 0) -}}
{{- $class := .Get "class" | default (.Get 1) }}
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
<iframe loading="lazy" src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}allowfullscreen title="YouTube Video"></iframe>
<div class="video-wrapper">
<iframe loading="lazy"
src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}"
allowfullscreen
title="YouTube Video"
>
</iframe>
</div>
{{ end -}}