mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
fix: missing height and weight of img element and lazyload object-fit style
This commit is contained in:
parent
568fe8f5fc
commit
428d8b88ab
3 changed files with 23 additions and 10 deletions
|
@ -230,14 +230,19 @@
|
|||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.lazyloading {
|
||||
@include object-fit(none);
|
||||
.lazyload, .lazyloading {
|
||||
@include object-fit(scale-down);
|
||||
}
|
||||
|
||||
.lazyloaded {
|
||||
@include object-fit(fill);
|
||||
}
|
||||
|
||||
blockquote {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{{- /* lazysizes and lightgallery */ -}}
|
||||
{{- $src := .Src -}}
|
||||
{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $width := .Width -}}
|
||||
{{- $height := .Height -}}
|
||||
{{- with dict "Path" $src "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- $width = $width | default .Width -}}
|
||||
{{- $height = $height | default .Height -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $small := .SrcSmall | default $src -}}
|
||||
|
@ -21,18 +25,22 @@
|
|||
<img
|
||||
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
|
||||
src="{{ $loading.RelPermalink }}"
|
||||
data-src="{{ .Src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-src="{{ $src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-sizes="auto"
|
||||
alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
||||
alt="{{ $alt }}"
|
||||
{{- with $width }} width="{{ . }}"{{ end }}
|
||||
{{- with $height }} height="{{ . }}"{{ end }} />
|
||||
</a>
|
||||
{{- else -}}
|
||||
<img
|
||||
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
|
||||
src="{{ $loading.RelPermalink }}"
|
||||
data-src="{{ .Src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-src="{{ $src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-sizes="auto"
|
||||
alt="{{ $alt }}"
|
||||
title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
||||
title="{{ .Title | default $alt }}"
|
||||
{{- with $width }} width="{{ . }}"{{ end }}
|
||||
{{- with $height }} height="{{ . }}"{{ end }} />
|
||||
{{- end -}}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue