Video Section - Dawn Theme - Make video smaller

Hello,

I have added a video section to my page but it is way too big for desktop. Is there a way to make the video box smaller and to the left and add text or something to fill the space on the right?

Any help would be appreciated!

Thanks

https://x3lo5ilcn6ealbwr-71289930044.shopifypreview.com

Hi @StarMintz

you can try to use this code


Hello @StarMintz ,

Duplicate the “image-with-text.liquid” and rename it. Then replace the below

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

{%- style -%}
  .section-{{ section.id }}-padding {
    padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
    padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
  }

  @media screen and (min-width: 750px) {
    .section-{{ section.id }}-padding {
      padding-top: {{ section.settings.padding_top }}px;
      padding-bottom: {{ section.settings.padding_bottom }}px;
    }
  }
{%- endstyle -%}

  

    

      

        {%- if section.settings.video != blank -%}
          {{ section.settings.video | video_tag: image_size: "500x", controls: true }}
        {%- endif -%}
      

    

    
      

        {%- for block in section.blocks -%}
          {% case block.type %}
            {%- when 'heading' -%}
              ## 
                {{ block.settings.heading }}
              
            {%- when 'caption' -%}
              

                {{ block.settings.caption | escape }}
              

            {%- when 'text' -%}
              
                {{ block.settings.text }}
              

          {%- endcase -%}
        {%- endfor -%}
      

    

  

{% schema %}
{
  "name": "Custom video with content",
  "class": "section",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [
    {
      "type": "video",
      "id": "video",
      "label": "Video"
    },
    {
      "type": "select",
      "id": "height",
      "options": [
        {
          "value": "adapt",
          "label": "Adapt to Image"
        },
        {
          "value": "small",
          "label": "Small"
        },
        {
          "value": "medium",
          "label": "Medium"
        },
        {
          "value": "large",
          "label": "Large"
        }
      ],
      "default": "adapt",
      "label": "Video Height"
    },
    {
      "type": "select",
      "id": "desktop_image_width",
      "options": [
        {
          "value": "",
          "label": "Small"
        },
        {
          "value": "medium",
          "label": "Medium"
        },
        {
          "value": "large",
          "label": "Large"
        }
      ],
      "default": "medium",
      "label": "Desktop image width",
      "info": "Image is automatically optimized for mobile."
    },
    {
      "type": "select",
      "id": "layout",
      "options": [
        {
          "value": "image_first",
          "label": "Image First"
        },
        {
          "value": "text_first",
          "label": "Image Second"
        }
      ],
      "default": "image_first",
      "label": "Desktop image placement",
      "info": "Image first is the default mobile layout."
    },
    {
      "type": "select",
      "id": "desktop_content_position",
      "options": [
        {
          "value": "top",
          "label": "Top"
        },
        {
          "value": "middle",
          "label": "Middle"
        },
        {
          "value": "bottom",
          "label": "Bottom"
        }
      ],
      "default": "top",
      "label": "Desktop content position"
    },
    {
      "type": "select",
      "id": "desktop_content_alignment",
      "options": [
        {
          "value": "left",
          "label": "Left"
        },
        {
          "value": "center",
          "label": "Center"
        },
        {
          "value": "right",
          "label": "Right"
        }
      ],
      "default": "left",
      "label": "Desktop content alignment"
    },
    {
      "type": "select",
      "id": "content_layout",
      "options": [
        {
          "value": "no-overlap",
          "label": "No Overlap"
        },
        {
          "value": "overlap",
          "label": "Overlap"
        }
      ],
      "default": "no-overlap",
      "label": "Content layout"
    },
    {
      "type": "select",
      "id": "color_scheme",
      "options": [
        {
          "value": "accent-1",
          "label": "Accent 1"
        },
        {
          "value": "accent-2",
          "label": "Accent 2"
        },
        {
          "value": "background-1",
          "label": "Background 1"
        },
        {
          "value": "background-2",
          "label": "Background 2"
        },
        {
          "value": "inverse",
          "label": "Inverse"
        }
      ],
      "default": "background-1",
      "label": "Color scheme"
    },
    {
      "type": "header",
      "content": "Animations"
    },
    {
      "type": "select",
      "id": "image_behavior",
      "options": [
        {
          "value": "none",
          "label": "None"
        },
        {
          "value": "ambient",
          "label": "Ambient Movement"
        }
      ],
      "default": "none",
      "label": "Image behavior"
    },
    {
      "type": "header",
      "content": "Mobile layout"
    },
    {
      "type": "select",
      "id": "mobile_content_alignment",
      "options": [
        {
          "value": "left",
          "label": "Left"
        },
        {
          "value": "center",
          "label": "Center"
        },
        {
          "value": "right",
          "label": "Right"
        }
      ],
      "default": "left",
      "label": "Mobile content alignment"
    },
    {
      "type": "header",
      "content": "Section padding"
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "Top Padding",
      "default": 36
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "Bottom Padding",
      "default": 36
    }
  ],
  "blocks": [
    {
      "type": "heading",
      "name": "Heading",
      "limit": 1,
      "settings": [
        {
          "type": "inline_richtext",
          "id": "heading",
          "default": "Image with text",
          "label": "Heading"
        },
        {
          "type": "select",
          "id": "heading_size",
          "options": [
            {
              "value": "h2",
              "label": "Small"
            },
            {
              "value": "h1",
              "label": "Medium"
            },
            {
              "value": "h0",
              "label": "Large"
            }
          ],
          "default": "h1",
          "label": "Heading size"
        }
      ]
    },
    {
      "type": "caption",
      "name": "Caption",
      "limit": 1,
      "settings": [
        {
          "type": "text",
          "id": "caption",
          "default": "Add a tagline",
          "label": "Text"
        },
        {
          "type": "select",
          "id": "text_style",
          "options": [
            {
              "value": "subtitle",
              "label": "Subtitle"
            },
            {
              "value": "caption-with-letter-spacing",
              "label": "Uppercase"
            }
          ],
          "default": "caption-with-letter-spacing",
          "label": "Text style"
        },
        {
          "type": "select",
          "id": "text_size",
          "options": [
            {
              "value": "small",
              "label": "Small"
            },
            {
              "value": "medium",
              "label": "Medium"
            },
            {
              "value": "large",
              "label": "Large"
            }
          ],
          "default": "medium",
          "label": "Text size"
        }
      ]
    },
    {
      "type": "text",
      "name": "Text",
      "limit": 1,
      "settings": [
        {
          "type": "richtext",
          "id": "text",
          "default": "

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.

",
          "label": "Text"
        },
        {
          "type": "select",
          "id": "text_style",
          "options": [
            {
              "value": "body",
              "label": "Body"
            },
            {
              "value": "subtitle",
              "label": "Subtitle"
            }
          ],
          "default": "body",
          "label": "Text Style"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Custom video with content",
      "blocks": [
        {
          "type": "heading"
        },
        {
          "type": "text"
        }
      ]
    }
  ]
}
{% endschema %}

code in the duplicate file:

great

is there a way to add a thumbnail to the video?

Hi @StarMintz
Can you explain more?
You need a thumbnail over the video until you play video, correct?

yes thats right

Hello @StarMintz ,

Replace the previous code with the below code:

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

{%- style -%}
  .section-{{ section.id }}-padding {
    padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
    padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
  }

  @media screen and (min-width: 750px) {
    .section-{{ section.id }}-padding {
      padding-top: {{ section.settings.padding_top }}px;
      padding-bottom: {{ section.settings.padding_bottom }}px;
    }
  }
  .video_content_with_text {
    object-fit: cover;
  }
{%- endstyle -%}

  

    

      

        {% assign video_thumb = section.settings.preview_image | img_url: 'master' %}
        {%- if section.settings.video != blank -%}
          {{ section.settings.video | media_tag: controls: true, poster: video_thumb, class: 'video_content_with_text' }}
        {%- endif -%}
      

    

    
      

        {%- for block in section.blocks -%}
          {% case block.type %}
            {%- when 'heading' -%}
              ## 
                {{ block.settings.heading }}
              
            {%- when 'caption' -%}
              

                {{ block.settings.caption | escape }}
              

            {%- when 'text' -%}
              
                {{ block.settings.text }}
              

          {%- endcase -%}
        {%- endfor -%}
      

    

  

{% schema %}
{
  "name": "Custom video with content",
  "class": "section",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [
    {
      "type": "video",
      "id": "video",
      "label": "Video"
    },
    {
      "type": "image_picker",
      "id": "preview_image",
      "label": "Preview Image"
      "info": "Add poster image for video"
    },
    {
      "type": "select",
      "id": "height",
      "options": [
        {
          "value": "adapt",
          "label": "Adapt to Image"
        },
        {
          "value": "small",
          "label": "Small"
        },
        {
          "value": "medium",
          "label": "Medium"
        },
        {
          "value": "large",
          "label": "Large"
        }
      ],
      "default": "adapt",
      "label": "Video Height"
    },
    {
      "type": "select",
      "id": "desktop_image_width",
      "options": [
        {
          "value": "",
          "label": "Small"
        },
        {
          "value": "medium",
          "label": "Medium"
        },
        {
          "value": "large",
          "label": "Large"
        }
      ],
      "default": "medium",
      "label": "Desktop image width",
      "info": "Image is automatically optimized for mobile."
    },
    {
      "type": "select",
      "id": "layout",
      "options": [
        {
          "value": "image_first",
          "label": "Image First"
        },
        {
          "value": "text_first",
          "label": "Image Second"
        }
      ],
      "default": "image_first",
      "label": "Desktop image placement",
      "info": "Image first is the default mobile layout."
    },
    {
      "type": "select",
      "id": "desktop_content_position",
      "options": [
        {
          "value": "top",
          "label": "Top"
        },
        {
          "value": "middle",
          "label": "Middle"
        },
        {
          "value": "bottom",
          "label": "Bottom"
        }
      ],
      "default": "top",
      "label": "Desktop content position"
    },
    {
      "type": "select",
      "id": "desktop_content_alignment",
      "options": [
        {
          "value": "left",
          "label": "Left"
        },
        {
          "value": "center",
          "label": "Center"
        },
        {
          "value": "right",
          "label": "Right"
        }
      ],
      "default": "left",
      "label": "Desktop content alignment"
    },
    {
      "type": "select",
      "id": "content_layout",
      "options": [
        {
          "value": "no-overlap",
          "label": "No Overlap"
        },
        {
          "value": "overlap",
          "label": "Overlap"
        }
      ],
      "default": "no-overlap",
      "label": "Content layout"
    },
    {
      "type": "select",
      "id": "color_scheme",
      "options": [
        {
          "value": "accent-1",
          "label": "Accent 1"
        },
        {
          "value": "accent-2",
          "label": "Accent 2"
        },
        {
          "value": "background-1",
          "label": "Background 1"
        },
        {
          "value": "background-2",
          "label": "Background 2"
        },
        {
          "value": "inverse",
          "label": "Inverse"
        }
      ],
      "default": "background-1",
      "label": "Color scheme"
    },
    {
      "type": "header",
      "content": "Animations"
    },
    {
      "type": "select",
      "id": "image_behavior",
      "options": [
        {
          "value": "none",
          "label": "None"
        },
        {
          "value": "ambient",
          "label": "Ambient Movement"
        }
      ],
      "default": "none",
      "label": "Image behavior"
    },
    {
      "type": "header",
      "content": "Mobile layout"
    },
    {
      "type": "select",
      "id": "mobile_content_alignment",
      "options": [
        {
          "value": "left",
          "label": "Left"
        },
        {
          "value": "center",
          "label": "Center"
        },
        {
          "value": "right",
          "label": "Right"
        }
      ],
      "default": "left",
      "label": "Mobile content alignment"
    },
    {
      "type": "header",
      "content": "Section padding"
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "Top Padding",
      "default": 36
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "Bottom Padding",
      "default": 36
    }
  ],
  "blocks": [
    {
      "type": "heading",
      "name": "Heading",
      "limit": 1,
      "settings": [
        {
          "type": "inline_richtext",
          "id": "heading",
          "default": "Image with text",
          "label": "Heading"
        },
        {
          "type": "select",
          "id": "heading_size",
          "options": [
            {
              "value": "h2",
              "label": "Small"
            },
            {
              "value": "h1",
              "label": "Medium"
            },
            {
              "value": "h0",
              "label": "Large"
            }
          ],
          "default": "h1",
          "label": "Heading size"
        }
      ]
    },
    {
      "type": "caption",
      "name": "Caption",
      "limit": 1,
      "settings": [
        {
          "type": "text",
          "id": "caption",
          "default": "Add a tagline",
          "label": "Text"
        },
        {
          "type": "select",
          "id": "text_style",
          "options": [
            {
              "value": "subtitle",
              "label": "Subtitle"
            },
            {
              "value": "caption-with-letter-spacing",
              "label": "Uppercase"
            }
          ],
          "default": "caption-with-letter-spacing",
          "label": "Text style"
        },
        {
          "type": "select",
          "id": "text_size",
          "options": [
            {
              "value": "small",
              "label": "Small"
            },
            {
              "value": "medium",
              "label": "Medium"
            },
            {
              "value": "large",
              "label": "Large"
            }
          ],
          "default": "medium",
          "label": "Text size"
        }
      ]
    },
    {
      "type": "text",
      "name": "Text",
      "limit": 1,
      "settings": [
        {
          "type": "richtext",
          "id": "text",
          "default": "

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.

",
          "label": "Text"
        },
        {
          "type": "select",
          "id": "text_style",
          "options": [
            {
              "value": "body",
              "label": "Body"
            },
            {
              "value": "subtitle",
              "label": "Subtitle"
            }
          ],
          "default": "body",
          "label": "Text Style"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Custom video with content",
      "blocks": [
        {
          "type": "heading"
        },
        {
          "type": "text"
        }
      ]
    }
  ]
}
{% endschema %}

Unable to update the file

  • Invalid JSON in tag ‘schema’

Get this error when trying to save

Hi @StarMintz ,

Sorry for the mistake, add a comma after - “label”: “Preview Image” in the schema

Hello! Thanks for your code. It works great. However, the video section does not show up on mobile. How to fix it? I want it to be shown on mobile also. Thanks!