Re: Dawn Theme - Video with Text Section

Solved

How can I create a video with text section in the Dawn theme?

vincentdh
Tourist
9 2 39

Hi Community and Experts!

I am currently struggling with the following task:

 

I want to create a "Video with Text" section just like the "Image with Text" section. I found the following discussion where the Problem was solved, but no real solution was given: https://community.shopify.com/c/shopify-design/how-to-make-a-video-with-image-section-in-shopify/td-...

In the End it should look like this: https://myblend.se/pages/instructions

 

So, autoplay and loop as well.

 

I guess as stated in the discussion, duplicate the "Image with Text" section in the Section Folder in "Edit Code" and replace the Image code with video code. I cant figure out which is which and with what code to replace, the video.liquid code?

 

Edit: As well as add/configure an Asset .css

 

Thanks for the help!

 

@Zworthkey @KetanKumar 

Accepted Solutions (2)

vincentdh
Tourist
9 2 39

This is an accepted solution.

Hi everyone!

 

I hired a coder to do it since I couldn't fin anything helpful. Here you go:

 

Create a new section with this code, called "video-with-text.liquid"

 

{{ 'component-video-with-text.css' | asset_url | stylesheet_tag }}

<div class="video-with-text {% if section.settings.full_width %}video-with-text--full-width{% else %}page-width{% endif %} color-scheme-{{ section.settings.color_scheme }}">
  <div class="video-with-text__grid color-{{ section.settings.color_scheme }} grid grid--gapless grid--1-col grid--2-col-tablet gradient{% if section.settings.layout == 'text_first' %} video-with-text__grid--reverse{% endif %}">
    <div class="grid__item">
      <div class="video-with-text__media image-with-text__media--{{ section.settings.height }} media">
        <video style="max-width: 100%; height: 100%;" autoplay="autoplay" loop="loop" muted="" webkit-playsinline="" playsinline="">
          <source src="{{ section.settings.video_url }}" type="video/mp4" />
        </video>
      </div>
    </div>
    <div class="grid__item">
      <div class="video-with-text__content video-with-text__content--{{ section.settings.height }}">
        {%- for block in section.blocks -%}
          {% case block.type %}
            {%- when 'heading' -%}
              <h2 class="video-with-text__heading h1" {{ block.shopify_attributes }}>
                {{ block.settings.heading | escape }}
              </h2>
            {%- when 'text' -%}
              <div class="video-with-text__text rte" {{ block.shopify_attributes }}>{{ block.settings.text }}</div>
            {%- when 'button' -%}
              {%- if block.settings.button_label != blank -%}
                <a{% if block.settings.button_link != blank %} href="{{ block.settings.button_link }}"{% endif %} class="button{% if block.settings.button_style_secondary %} button--secondary{% else %} button--primary{% endif %}"{% if block.settings.button_link == blank %} aria-disabled="true"{% endif %} {{ block.shopify_attributes }}>
                  {{ block.settings.button_label | escape }}
                </a>
              {%- endif -%}
          {%- endcase -%}
        {%- endfor -%}
      </div>
    </div>
  </div>
</div>

{% schema %}
{
  "name": "Video with text",
  "class": "spaced-section spaced-section--full-width",
  "settings": [
    {
      "type": "select",
      "id": "color_scheme",
      "options": [
        {
          "value": "background-1",
          "label": "Background 1"
        },
        {
          "value": "background-2",
          "label": "Background 2"
        },
        {
          "value": "inverse",
          "label": "Inverse"
        },
        {
          "value": "accent-1",
          "label": "Accent 1"
        },
        {
          "value": "accent-2",
          "label": "Accent 2"
        }
      ],
      "default": "background-1",
      "label": "Color scheme"
    },
    {
      "type": "text",
      "id": "video_url",
      "default": "https://cdn.shopify.com/s/files/1/0050/2779/0919/files/1_1_Cutting_fruit_H.mp4?v=1603372350",
      "label": "Video url",
      "info": "Upload your video to Shopify then paste the url here"
    },
    {
      "type": "select",
      "id": "height",
      "options": [
        {
          "value": "adapt",
          "label": "Adapt"
        },
        {
          "value": "small",
          "label": "Small"
        },
        {
          "value": "large",
          "label": "Large"
        }
      ],
      "default": "adapt",
      "label": "Video ratio"
    },
    {
      "type": "select",
      "id": "layout",
      "options": [
        {
          "value": "image_first",
          "label": "Video first"
        },
        {
          "value": "text_first",
          "label": "Text first"
        }
      ],
      "default": "image_first",
      "label": "Desktop layout",
      "info": "Video first is the default mobile layout."
    }
  ],
  "blocks": [
    {
      "type": "heading",
      "name": "t:sections.video-with-text.blocks.heading.name",
      "limit": 1,
      "settings": [
        {
          "type": "text",
          "id": "heading",
          "default": "Image with text",
          "label": "Heading"
        }
      ]
    },
    {
      "type": "text",
      "name": "Text name",
      "limit": 1,
      "settings": [
        {
          "type": "richtext",
          "id": "text",
          "default": "<p>Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.</p>",
          "label": "Description"
        }
      ]
    },
    {
      "type": "button",
      "name": "Button name",
      "limit": 1,
      "settings": [
        {
          "type": "text",
          "id": "button_label",
          "default": "Button label",
          "label": "Button label",
          "info": "Leave the label blank to hide the button."
        },
        {
          "type": "url",
          "id": "button_link",
          "label": "Button link"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Video with text",
      "blocks": [
        {
          "type": "heading"
        },
        {
          "type": "text"
        },
        {
          "type": "button"
        }
      ]
    }
  ]
}
{% endschema %}

 

And create a new asset called "component-video-with-text.css" with this code:

 

.video-with-text {
  margin-top: 5rem;
}

.video-with-text:not(.color-scheme-background-1) {
  margin-bottom: 5rem;
}

@media screen and (min-width: 750px) {
  .video-with-text {
    margin-bottom: calc(5rem + var(--page-width-margin));
  }
}

.video-with-text .grid {
  margin-left: 0;
  margin-bottom: 0;
}

.video-with-text__grid {
  overflow: hidden;
}

@media screen and (min-width: 750px) {
  .video-with-text__grid--reverse {
    flex-direction: row-reverse;
  }
}

.video-with-text__media {
  background-color: transparent;
  min-height: 100%;
}

.video-with-text__media--small {
  height: 19.4rem;
}

.video-with-text__media--large {
  height: 40rem;
}

@media screen and (min-width: 750px) {
  .video-with-text__media--small {
    height: 31.4rem;
  }

  .video-with-text__media--large {
    height: 60rem;
  }
}

.video-with-text__media--placeholder {
  background-color: rgba(var(--color-foreground), 0.04);
  position: relative;
  overflow: hidden;
}

.video-with-text__media--placeholder.video-with-text__media--adapt {
  height: 20rem;
}

@media screen and (min-width: 750px) {
  .video-with-text__media--placeholder.video-with-text__media--adapt {
    height: 30rem;
  }
}

.video-with-text__media--placeholder > svg {
  position: absolute;
  left: 50%;
  max-width: 80rem;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  fill: currentColor;
}

.video-with-text__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
  justify-content: center;
  padding: 4rem calc(4rem / var(--font-body-scale)) 5rem;
}

@media screen and (min-width: 750px) {
  .video-with-text__grid--reverse .video-with-text__content {
    margin-left: auto;
  }
}

@media screen and (min-width: 750px) {
  .video-with-text__content {
    padding: 6rem 7rem 7rem;
  }
}

.video-with-text__content > * + * {
  margin-top: 2rem;
}

.video-with-text__content > .video-with-text__text:empty ~ a {
  margin-top: 2rem;
}

.video-with-text__content > :first-child:is(.video-with-text__heading) {
  margin-top: 0;
}

.video-with-text__content :last-child:is(.video-with-text__heading) {
  margin-bottom: 0;
}

.video-with-text__content .button + .video-with-text__text {
  margin-top: 2rem;
}

.video-with-text__content .video-with-text__text + .button {
  margin-top: 3rem;
}

.video-with-text__heading {
  margin-bottom: 0;
}

.video-with-text__text p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.video-with-text__content {
  padding-left: 15px !important;
  padding-right: 15px !important;
}

 

 

View solution in original post

KetanKumar
Shopify Partner
37595 3668 12156

This is an accepted solution.

@Bkimbrell 

thanks for more details can you please try this code

1. Go to Online Store->Theme-> Edit code
2. Asset->/base.css ->paste below code at the bottom of the file.

@media screen and (max-width: 749px) {
.video-with-text video {
    position: relative !important;
}
}

 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing

View solution in original post

Replies 125 (125)
eCommtique
Visitor
1 0 0

Thanks so much for sharing this!

millermarket
Visitor
1 0 0

Thank you

ChodaBRO
Tourist
8 0 0

Thanks!!

glowyglowtea
Visitor
1 0 0

Hi!!! This worked wonderfully however on mobile it is blank and any suggestions below did not work... can anyone help please?

Gumf
Shopify Partner
26 1 3

Can't thank you enough for this! 

Gumf
Shopify Partner
26 1 3

If anyone is having the problem of the video not displaying on mobile just add this code to the bottom of the 'component-video-with-text.css' file:

@media screen and (max-width: 740px) {
.media>*:not(.zoom):not(.deferred-media__poster-button), .media model-viewer {
    display: block;
   position: relative;
}
}
chefsimecek
Excursionist
25 0 8

Hey, I would like to ask which parts of the second code I have to change to adjust the video sizes on the deskopt. Thank you!

Canterpants
Visitor
1 0 0

Hi.  I have been following the steps to set this up in my new online store and I have managed to get the bugs out and have it showing on mobile thanks to the threads.  It all looked really good, until I wanted to then add more sections into the page.

In total I have 4 video with text sections on my page.  When I start the first video and then pause it to start the next video, it simply restarts my first section's video.  That is a real problem that I need to resolve and ideally I'd like to have all of the videos have their own normal controls (ie volume control, stop, start, pause) without the play / pause buttons.  Are you able to help with this?

sumanbhat
Explorer
60 1 20

 hi @vincentdh  can you please le me know which theme you using? for the myblend . please

 

KetanKumar
Shopify Partner
37595 3668 12156

@sumanbhat 

Dawn Theme 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing

whereswaldo
Tourist
5 0 1

The audio on the video with text doesn't work on my website, anyone know how to fix that?

mitzvahraps
Tourist
3 0 0

@whereswaldo you'll need to go into the `video-with-text.liquid` file and add in a small piece of code. 

Do a CTRL+F (or COMMAND+F) and search for "<video style" to see the line I'm referring to below. You'll want to add in the instructions 

 

controls = "true"

 

this will allow the video controls to appear. 

 

The whole line should look like this

 

<video style="max-width: 100%; height: 100%;" autoplay="autoplay" controls= "true" muted = "" loop="loop" webkit-playsinline="" playsinline=""> 

<source src="{{ section.settings.video_url }}" type="video/mp4" />

</video>

 

firststop
Excursionist
24 0 11

This code worked for desktop, but the video doesn't show up for mobile. 😞 Any ideas why?

Spac-es
Shopify Partner
406 119 154

👉Re: Dawn Theme - Sección de video con texto - Shopify Comunidad

Any donation is welcome! https://www.buymeacoffee.com/spacescoffee Thanks in advance!

xSeanx
Shopify Partner
11 0 3

Sorry to dig up an older thread, but is there a way to have videos without the text and use them in columns?

 

Spac-es
Shopify Partner
406 119 154

You can add only one video without text. Shopify provides you with a section where you can embed a YouTube video or upload your own.

 

You can modify that file to add multiple videos in the form of columns. You can find it in your code, it's called: video.liquid


Captura.PNG

 

Any donation is welcome! https://www.buymeacoffee.com/spacescoffee Thanks in advance!
VARTIX
Excursionist
23 1 4

Never mind! Solved it! I forgot a piece of code 

made4Uo
Shopify Partner
3873 718 1217

Hi @xSeanx 

 

Unfortunately, to have video in columns that would be a custom code and you will need to hire a developer to do so.

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free

Hey_Jak
Shopify Partner
135 9 25

Easier Solution here:

❤️ Buy me a coffee
- Check my youtube: Hey Jak
Was your question answered? Mark it as an Accepted Solution.

KelseyNewie
Visitor
1 0 0

This is amazing, thanks so much! 

I am wishing to use a coloured background. Any insights on how to make the background colour the full width of the screen please?

 

SOE-Commerce
Tourist
7 0 3

Is it also possible in the "Refresh" Theme? I Tried the Code and its not working for me.

KetanKumar
Shopify Partner
37595 3668 12156

@SOE-Commerce yes pleas share your store url so i will check and update you

 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
SOE-Commerce
Tourist
7 0 3
KetanKumar
Shopify Partner
37595 3668 12156

@SOE-Commerce thank for quick response 

got it your  point do you want video with text section at product page right?

do you want each product different video and text  or  same?

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
SOE-Commerce
Tourist
7 0 3

@KetanKumar yes and each product different video and text. Like the picture-text section but with a Video uploaded on shopify.

KetanKumar
Shopify Partner
37595 3668 12156

@SOE-Commerce  thanks for confirm and clear your asap, yes  its possible to make more customization code. if you want this please DM your details about more this customization code

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing