Shopify themes, liquid, logos, and UX
After adding this code (for a video with text) I found out, every page i make will have this video with text. When I delete this section on a specific page, the sections on the page I need them will also dissapear. It seems like they are all connected and i can not figure out how to just add this section without any consequences for the other pages. I need this video-with-text, but I just want to add them to 1 page and not to multiple.
website: https://fluffswiper.com/
The page I need the sections to work: https://fluffswiper.com/pages/hoe-werkt-het-product
Page what is connected: https://fluffswiper.com/pages/over-ons
Got the code from: https://community.shopify.com/c/shopify-design/dawn-theme-video-with-text-section/m-p/2165456#M57417...
I added everything correctly
{{ '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 }}" id="animation-container"> <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 preload="metadata" style="max-width: 100%; height: 100%;" id="videoPlayer" muted="" webkit-playsinline="" playsinline=""> <source src="{{ section.settings.video_url }}" type="video/mp4" /> </video> <div class="video-controls"> <button id="playButton" class="video-control-button" onclick="playPauseVideo()">Play</button> <button id="pauseButton" class="video-control-button" onclick="playPauseVideo()" style="display: none;">Pause</button> </div> </div> </div> <div class="grid__item"> <div id="VideoWithText--{{ section.id }}" class="video-with-text__content video-with-text__content--{{ section.settings.height }} image-with-text__content--desktop-{{ section.settings.desktop_content_alignment }} image-with-text__content--mobile-{{ section.settings.mobile_content_alignment }}"> {%- for block in section.blocks -%} {% case block.type %} {%- when 'heading' -%} <h2 class="image-with-text__heading inline-richtext {{ block.settings.heading_size }}" {{ block.shopify_attributes }} > {{ block.settings.heading }} </h2> {%- when 'caption' -%} <p class="image-with-text__text image-with-text__text--caption {{ block.settings.text_style }} {{ block.settings.text_style }}--{{ block.settings.text_size }} {{ block.settings.text_style }}" {{ block.shopify_attributes }} > {{ block.settings.caption | escape }} </p> {%- 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> <script> function playPauseVideo() { var videoPlayer = document.getElementById('videoPlayer'); var playButton = document.getElementById('playButton'); var pauseButton = document.getElementById('pauseButton'); if (videoPlayer.paused) { videoPlayer.play(); playButton.style.display = 'none'; pauseButton.style.display = 'inline-block'; } else { videoPlayer.pause(); playButton.style.display = 'inline-block'; pauseButton.style.display = 'none'; } } document.addEventListener('DOMContentLoaded', function() { var videoPlayer = document.getElementById('videoPlayer'); var playButton = document.getElementById('playButton'); var pauseButton = document.getElementById('pauseButton'); // Check if it is running on PC var isDesktop = window.matchMedia("(min-width: 1024px)").matches; // Autoplay on PC only if (isDesktop) { videoPlayer.autoplay = true; playButton.style.display = 'none'; pauseButton.style.display = 'inline-block'; } // Update buttons when pausing/playing the video and restart immediately when finished videoPlayer.addEventListener('pause', function() { playButton.style.display = 'inline-block'; pauseButton.style.display = 'none'; }); videoPlayer.addEventListener('play', function() { playButton.style.display = 'none'; pauseButton.style.display = 'inline-block'; }); if (isDesktop) { videoPlayer.addEventListener('ended', function() { videoPlayer.currentTime = 0; videoPlayer.play(); }); } // Add smooth fade out when restarting video on completion (mobile only) if (!isDesktop) { videoPlayer.addEventListener('ended', function() { fadeOut(videoPlayer, 300, function() { videoPlayer.currentTime = 0; fadeIn(videoPlayer, 300); videoPlayer.play(); }); }); } }); function fadeOut(element, duration, callback) { element.style.opacity = 1; var currentTime = 0; var increment = 0.05; var interval = setInterval(function() { currentTime += increment; element.style.opacity = 1 - currentTime; if (currentTime >= 1) { clearInterval(interval); callback(); } }, duration * increment); } function fadeIn(element, duration) { element.style.opacity = 0; var currentTime = 0; var increment = 0.05; var interval = setInterval(function() { currentTime += increment; element.style.opacity = currentTime; if (currentTime >= 1) { clearInterval(interval); } }, duration * increment); } </script> {% 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." }, { "type": "select", "id": "desktop_content_alignment", "options": [ { "value": "left", "label": "t:sections.image-with-text.settings.desktop_content_alignment.options__1.label" }, { "value": "center", "label": "t:sections.image-with-text.settings.desktop_content_alignment.options__2.label" }, { "value": "right", "label": "t:sections.image-with-text.settings.desktop_content_alignment.options__3.label" } ], "default": "left", "label": "t:sections.image-with-text.settings.desktop_content_alignment.label" }, { "type": "select", "id": "mobile_content_alignment", "options": [ { "value": "left", "label": "t:sections.image-with-text.settings.mobile_content_alignment.options__1.label" }, { "value": "center", "label": "t:sections.image-with-text.settings.mobile_content_alignment.options__2.label" }, { "value": "right", "label": "t:sections.image-with-text.settings.mobile_content_alignment.options__3.label" } ], "default": "left", "label": "t:sections.image-with-text.settings.mobile_content_alignment.label" } ], "blocks": [ { "type": "heading", "name": "t:sections.image-with-text.blocks.heading.name", "limit": 1, "settings": [ { "type": "inline_richtext", "id": "heading", "default": "Video with text", "label": "t:sections.image-with-text.blocks.heading.settings.heading.label" }, { "type": "select", "id": "heading_size", "options": [ { "value": "h2", "label": "t:sections.all.heading_size.options__1.label" }, { "value": "h1", "label": "t:sections.all.heading_size.options__2.label" }, { "value": "h0", "label": "t:sections.all.heading_size.options__3.label" } ], "default": "h1", "label": "t:sections.all.heading_size.label" } ] }, { "type": "caption", "name": "t:sections.image-with-text.blocks.caption.name", "limit": 1, "settings": [ { "type": "text", "id": "caption", "default": "Add a tagline", "label": "t:sections.image-with-text.blocks.caption.settings.text.label" }, { "type": "select", "id": "text_style", "options": [ { "value": "subtitle", "label": "t:sections.image-with-text.blocks.caption.settings.text_style.options__1.label" }, { "value": "caption-with-letter-spacing", "label": "t:sections.image-with-text.blocks.caption.settings.text_style.options__2.label" } ], "default": "caption-with-letter-spacing", "label": "t:sections.image-with-text.blocks.caption.settings.text_style.label" }, { "type": "select", "id": "text_size", "options": [ { "value": "small", "label": "t:sections.image-with-text.blocks.caption.settings.caption_size.options__1.label" }, { "value": "medium", "label": "t:sections.image-with-text.blocks.caption.settings.caption_size.options__2.label" }, { "value": "large", "label": "t:sections.image-with-text.blocks.caption.settings.caption_size.options__3.label" } ], "default": "medium", "label": "t:sections.image-with-text.blocks.caption.settings.caption_size.label" } ] }, { "type": "text", "name": "Text", "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 %}
.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; }
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024