From f347d63546f4b64092178696555fac7cb608a537 Mon Sep 17 00:00:00 2001 From: Daniel <46388253+dbkchu@users.noreply.github.com> Date: Wed, 15 Jun 2022 13:29:38 -0400 Subject: [PATCH] feat: add Slider background fit option to cover or contain image (#2715) Slider examples: To scale the image to fit within the slide: background: fit: contain To fill the slide with the image (default behavior): background: fit: cover --- wowchemy/layouts/partials/widgets/slider.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wowchemy/layouts/partials/widgets/slider.html b/wowchemy/layouts/partials/widgets/slider.html index f9371322..9b51d61c 100644 --- a/wowchemy/layouts/partials/widgets/slider.html +++ b/wowchemy/layouts/partials/widgets/slider.html @@ -27,9 +27,9 @@ {{ if $item.background.media }} {{ $bg_img := resources.Get (printf "media/%s" $item.background.media) }} {{ if $bg_img }} - {{ $style_bg = printf "%sbackground-image: url('%s'); background-repeat: no-repeat; background-position: %s; background-size: cover; " $style_bg $bg_img.Permalink ($item.background.position | default "center") }} + {{ $style_bg = printf "%sbackground-image: url('%s'); background-repeat: no-repeat; background-position: %s; background-size: %s; " $style_bg $bg_img.Permalink ($item.background.position | default "center") ($item.background.fit | default "cover") }} {{ else }} - {{ errorf "Couldn't find `%s` in the `assets/media/` folder - please add it." $item.overlay_img }} + {{ errorf "Couldn't find `%s` in the `assets/media/` folder - please add it." $item.background.media }} {{ end }} {{ with $item.background.brightness }} {{ $style_filter = printf "%s-webkit-backdrop-filter: brightness(%s); backdrop-filter: brightness(%s);" $style_filter (string .) (string .) }}