Hello everyone,
I have added a new setting to my image with a text section, which allows me to change the color of the heading text. However, I am facing an issue where changing the color affects all the headings in the image with text sections instead of just the one I want to modify. Could you please help me resolve this issue?
Image with text section 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;
}
.image-with-text__heading.h1 {
color: {{ section.settings.h3-text-color }} !important;
}
@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.image != blank -%}
{%- capture sizes -%}(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: 2 }}px, (min-width: 750px) calc((100vw - 130px) / 2), calc((100vw - 50px) / 2){%- endcapture -%}
{{
section.settings.image
| image_url: width: 1500
| image_tag: loading: 'lazy', sizes: sizes, widths: '165, 360, 535, 750, 1070, 1500'
}}
{%- else -%}
{{ 'image' | placeholder_svg_tag: 'placeholder-svg' }}
{%- endif -%}
{%- for block in section.blocks -%}
{% case block.type %}
{%- when 'heading' -%}
##
{{ block.settings.heading | escape }}
{%- when 'caption' -%}
{{ block.settings.caption | escape }}
{%- when 'text' -%}
{{ block.settings.text }}
{%- when 'button' -%}
{%- if block.settings.button_label != blank -%}
{{ block.settings.button_label | escape }}
{%- endif -%}
{%- endcase -%}
{%- endfor -%}
{% schema %}
{
"name": "t:sections.image-with-text.name",
"class": "section",
"settings": [
{
"type": "color",
"id": "h3-text-color",
"default": "#000000",
"label": "Sub Heading Color",
"info": "also for video with text Sub Heading Color"
},
{
"type": "select",
"id": "animation-once",
"options": [
{ "value": "true", "label": "once"},
{ "value": "false", "label": "unlimited"}
],
"label": "Play animation",
"default": "false"
},
{
"type": "select",
"id": "aos-title",
"options": [
{ "value": "none", "label": "Aucune"},
{ "value": "fade-in", "label": "Fade In"},
{ "value": "fade-up", "label": "Fade Up"},
{ "value": "fade-down", "label": "Fade Down"},
{ "value": "fade-right", "label": "Fade Right"},
{ "value": "fade-left", "label": "Fade Left"},
{ "value": "fade-up-right", "label": "Fade Up Right"},
{ "value": "fade-up-left", "label": "Fade Up Left"},
{ "value": "fade-down-right", "label": "Fade Down Right"},
{ "value": "fade-down-left", "label": "Fade Down Left"},
{ "value": "flip-left", "label": "Flip Left"},
{ "value": "flip-right", "label": "Flip Right"},
{ "value": "flip-up", "label": "Flip Up"},
{ "value": "flip-down", "label": "Flip Down"},
{ "value": "zoom-in", "label": "Zoom in"},
{ "value": "zoom-in-up", "label": "Zoom in Up"},
{ "value": "zoom-in-down", "label": "Zoom in Down"},
{ "value": "zoom-in-left", "label": "Zoom in Left"},
{ "value": "zoom-in-right", "label": "Zoom in Right"},
{ "value": "zoom-out", "label": "Zoom out"},
{ "value": "zoom-out-up", "label": "Zoom out Up"},
{ "value": "zoom-out-down", "label": "Zoom out Down"},
{ "value": "zoom-out-right", "label": "Zoom out Right"},
{ "value": "zoom-out-left", "label": "Zoom out Left"}
],
"label": "Image animation",
"default": "none"
},
{
"type": "select",
"id": "text-title",
"options": [
{ "value": "none", "label": "Aucune"},
{ "value": "fade-in", "label": "Fade In"},
{ "value": "fade-up", "label": "Fade Up"},
{ "value": "fade-down", "label": "Fade Down"},
{ "value": "fade-right", "label": "Fade Right"},
{ "value": "fade-left", "label": "Fade Left"},
{ "value": "fade-up-right", "label": "Fade Up Right"},
{ "value": "fade-up-left", "label": "Fade Up Left"},
{ "value": "fade-down-right", "label": "Fade Down Right"},
{ "value": "fade-down-left", "label": "Fade Down Left"},
{ "value": "flip-left", "label": "Flip Left"},
{ "value": "flip-right", "label": "Flip Right"},
{ "value": "flip-up", "label": "Flip Up"},
{ "value": "flip-down", "label": "Flip Down"},
{ "value": "zoom-in", "label": "Zoom in"},
{ "value": "zoom-in-up", "label": "Zoom in Up"},
{ "value": "zoom-in-down", "label": "Zoom in Down"},
{ "value": "zoom-in-left", "label": "Zoom in Left"},
{ "value": "zoom-in-right", "label": "Zoom in Right"},
{ "value": "zoom-out", "label": "Zoom out"},
{ "value": "zoom-out-up", "label": "Zoom out Up"},
{ "value": "zoom-out-down", "label": "Zoom out Down"},
{ "value": "zoom-out-right", "label": "Zoom out Right"},
{ "value": "zoom-out-left", "label": "Zoom out Left"}
],
"label": "Text animation",
"default": "none"
},
{
"type": "select",
"id": "aos-duration",
"options": [
{ "value": "500", "label": "0.5s"},
{ "value": "1000", "label": "1s"},
{ "value": "1500", "label": "1.5s"},
{ "value": "2000", "label": "2s"},
{ "value": "2500", "label": "2.5s"}
],
"label": "The animation duration",
"default": "1500"
},
{
"type": "image_picker",
"id": "image",
"label": "t:sections.image-with-text.settings.image.label"
},
{
"type": "select",
"id": "height",
"options": [
{
"value": "adapt",
"label": "t:sections.image-with-text.settings.height.options__1.label"
},
{
"value": "small",
"label": "t:sections.image-with-text.settings.height.options__2.label"
},
{
"value": "large",
"label": "t:sections.image-with-text.settings.height.options__3.label"
}
],
"default": "adapt",
"label": "t:sections.image-with-text.settings.height.label"
},
{
"type": "select",
"id": "desktop_image_width",
"options": [
{
"value": "small",
"label": "t:sections.image-with-text.settings.desktop_image_width.options__1.label"
},
{
"value": "medium",
"label": "t:sections.image-with-text.settings.desktop_image_width.options__2.label"
},
{
"value": "large",
"label": "t:sections.image-with-text.settings.desktop_image_width.options__3.label"
}
],
"default": "medium",
"label": "t:sections.image-with-text.settings.desktop_image_width.label",
"info": "t:sections.image-with-text.settings.desktop_image_width.info"
},
{
"type": "select",
"id": "layout",
"options": [
{
"value": "image_first",
"label": "t:sections.image-with-text.settings.layout.options__1.label"
},
{
"value": "text_first",
"label": "t:sections.image-with-text.settings.layout.options__2.label"
}
],
"default": "image_first",
"label": "t:sections.image-with-text.settings.layout.label",
"info": "t:sections.image-with-text.settings.layout.info"
},
{
"type": "select",
"id": "desktop_content_position",
"options": [
{
"value": "top",
"label": "t:sections.image-with-text.settings.desktop_content_position.options__1.label"
},
{
"value": "middle",
"label": "t:sections.image-with-text.settings.desktop_content_position.options__2.label"
},
{
"value": "bottom",
"label": "t:sections.image-with-text.settings.desktop_content_position.options__3.label"
}
],
"default": "top",
"label": "t:sections.image-with-text.settings.desktop_content_position.label"
},
{
"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": "content_layout",
"options": [
{
"value": "no-overlap",
"label": "t:sections.image-with-text.settings.content_layout.options__1.label"
},
{
"value": "overlap",
"label": "t:sections.image-with-text.settings.content_layout.options__2.label"
}
],
"default": "no-overlap",
"label": "t:sections.image-with-text.settings.content_layout.label"
},
{
"type": "select",
"id": "color_scheme",
"options": [
{
"value": "accent-1",
"label": "t:sections.all.colors.accent_1.label"
},
{
"value": "accent-2",
"label": "t:sections.all.colors.accent_2.label"
},
{
"value": "background-1",
"label": "t:sections.all.colors.background_1.label"
},
{
"value": "background-2",
"label": "t:sections.all.colors.background_2.label"
},
{
"value": "inverse",
"label": "t:sections.all.colors.inverse.label"
}
],
"default": "background-1",
"label": "t:sections.all.colors.label"
},
{
"type": "header",
"content": "Mobile layout"
},
{
"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"
},
{
"type": "header",
"content": "t:sections.all.padding.section_padding_heading"
},
{
"type": "range",
"id": "padding_top",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_top",
"default": 36
},
{
"type": "range",
"id": "padding_bottom",
"min": 0,
"max": 100,
"step": 4,
"unit": "px",
"label": "t:sections.all.padding.padding_bottom",
"default": 36
}
],
"blocks": [
{
"type": "heading",
"name": "t:sections.image-with-text.blocks.heading.name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "heading",
"default": "Image 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": "t:sections.image-with-text.blocks.text.name",
"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": "t:sections.image-with-text.blocks.text.settings.text.label"
},
{
"type": "select",
"id": "text_style",
"options": [
{
"value": "body",
"label": "t:sections.image-with-text.blocks.text.settings.text_style.options__1.label"
},
{
"value": "subtitle",
"label": "t:sections.image-with-text.blocks.text.settings.text_style.options__2.label"
}
],
"default": "body",
"label": "t:sections.image-with-text.blocks.text.settings.text_style.label"
}
]
},
{
"type": "button",
"name": "t:sections.image-with-text.blocks.button.name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "button_label",
"default": "Button label",
"label": "t:sections.image-with-text.blocks.button.settings.button_label.label",
"info": "t:sections.image-with-text.blocks.button.settings.button_label.info"
},
{
"type": "url",
"id": "button_link",
"label": "t:sections.image-with-text.blocks.button.settings.button_link.label"
}
]
}
],
"presets": [
{
"name": "t:sections.image-with-text.presets.name",
"blocks": [
{
"type": "heading"
},
{
"type": "text"
},
{
"type": "button"
}
]
}
]
}
{% endschema %}