mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 12:03:31 +08:00
fix(article): video iframe margin
This commit is contained in:
parent
b10a0ab002
commit
684bbfd8af
@ -300,12 +300,31 @@
|
|||||||
color: var(--card-text-color-main);
|
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
|
/// Negative margins
|
||||||
blockquote,
|
blockquote,
|
||||||
figure,
|
figure,
|
||||||
.gallery,
|
.gallery,
|
||||||
pre {
|
pre,
|
||||||
|
.video-wrapper,
|
||||||
|
.s_video_simple {
|
||||||
margin-left: calc((var(--card-padding)) * -1);
|
margin-left: calc((var(--card-padding)) * -1);
|
||||||
margin-right: calc((var(--card-padding)) * -1);
|
margin-right: calc((var(--card-padding)) * -1);
|
||||||
|
width: calc(100% + var(--card-padding) * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,12 @@
|
|||||||
<p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
|
<p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
|
||||||
{{ end }}
|
{{ 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 }}"
|
<iframe src="//player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
|
||||||
scrolling="no"
|
scrolling="no"
|
||||||
frameborder="no"
|
frameborder="no"
|
||||||
framespacing="0"
|
framespacing="0"
|
||||||
allowfullscreen="true"
|
allowfullscreen="true"
|
||||||
style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"
|
|
||||||
>
|
>
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{{ $vid := .Get 0 }}
|
{{ $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"
|
<iframe src="http://v.qq.com/txp/iframe/player.html?vid={{ $vid }}&auto=0"
|
||||||
scrolling="no"
|
scrolling="no"
|
||||||
frameborder="no"
|
frameborder="no"
|
||||||
framespacing="0"
|
framespacing="0"
|
||||||
allowfullscreen="true"
|
allowfullscreen="true"
|
||||||
style="position: absolute; width: 100%; height: 100%;">
|
>
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
@ -2,8 +2,12 @@
|
|||||||
{{- if not $pc.Disable -}}
|
{{- if not $pc.Disable -}}
|
||||||
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
|
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
|
||||||
{{- $id := .Get "id" | default (.Get 0) -}}
|
{{- $id := .Get "id" | default (.Get 0) -}}
|
||||||
{{- $class := .Get "class" | default (.Get 1) }}
|
<div class="video-wrapper">
|
||||||
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
|
<iframe loading="lazy"
|
||||||
<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>
|
src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}"
|
||||||
|
allowfullscreen
|
||||||
|
title="YouTube Video"
|
||||||
|
>
|
||||||
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
{{ end -}}
|
{{ end -}}
|
Loading…
Reference in New Issue
Block a user