Create a new section-side by side pictures with text

Solved

Create a new section-side by side pictures with text

Samer1
Shopify Partner
4 0 0

Hello

I am trying to create a side by side Image section with an overlay text and call to action button similar to the below.

I am using Dawn

Samer1_0-1715521395041.png

 

Accepted Solution (1)
Arif_Shopidevs
Shopify Partner
521 44 93

This is an accepted solution.

hi @Samer1  ,

 

I have made a section for you here is the code. and output
13-05-24-support-custom-hover.jpeg

<style>
  .container {
    display: flex;
  }
  .column {
    flex: 1;
    margin: 10px;
    position: relative;
    overflow: hidden;
  }
  .image {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
  }
  .text {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    width: 100%;
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }
  .text h2{
    color:#FFF;
  }
  .column:hover .text {
    transform: translateY(0);
  }
  .column:hover .image {
    transform: scale(1.1);
  }
  .cta-button {
  display: inline-block;
  background-color: #007bff;
  color: #ffffff;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.cta-button:hover {
  background-color: #0056b3;
}

</style>
<div class="container">
  {% for block in section.blocks %}
    <div class="column" style="width: {{ block.settings.width }}px;">
      <img
        class="image"
        src="{{ block.settings.image | img_url: 'large' }}"
        alt="{{ block.settings.image.alt }}"
        width="{{ block.settings.width }}"
        height="{{ block.settings.height }}"
      >
      <div class="text">
        <h2>{{ block.settings.heading }}</h2>
        <p>{{ block.settings.text }}</p>
        <a href="{{ block.settings.button_link }}" class="cta-button">{{ block.settings.button_label }}</a>
      </div>
    </div>
  {% endfor %}
</div>

{% schema %}
{
  "name": "Hover Image",
  "class": "section",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [



  ],
  "blocks": [
    {
      "type": "heading",
      "name": "t:sections.image-with-text.blocks.heading.name",
      "limit": 2,
      "settings": [
        {
      "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": "medium",
          "label": "t:sections.image-with-text.settings.height.options__3.label"
        },
        {
          "value": "large",
          "label": "t:sections.image-with-text.settings.height.options__4.label"
        }
      ],
      "default": "adapt",
      "label": "t:sections.image-with-text.settings.height.label"
    } ,
        {
          "type": "inline_richtext",
          "id": "heading",
          "default": "Image with text",
          "label": "t:sections.image-with-text.blocks.heading.settings.heading.label"
        },
         {
          "type": "text",
          "id": "button_label",
          "default": "Button Label",
          "label": "Button Label"
        },
         {
          "type": "url",
          "id": "button_link",
          "label": "Button Link"
        }



      ]
    }


  ],
  "presets": [
    {
      "name": "t:sections.image-with-text.presets.name",
      "blocks": [
        {
          "type": "heading"
        }
      ]
    }
  ]
}
{% endschema %}

Hope this will help you.

Regards
Shopidevs

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

View solution in original post

Replies 6 (6)

Arif_Shopidevs
Shopify Partner
521 44 93

Hi, you want to create new section or want to use exting section image with text 

The it is easy to give a solution.

Thank you 

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

Samer1
Shopify Partner
4 0 0

Whichever solution is easier

Arif_Shopidevs
Shopify Partner
521 44 93

This is an accepted solution.

hi @Samer1  ,

 

I have made a section for you here is the code. and output
13-05-24-support-custom-hover.jpeg

<style>
  .container {
    display: flex;
  }
  .column {
    flex: 1;
    margin: 10px;
    position: relative;
    overflow: hidden;
  }
  .image {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
  }
  .text {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    width: 100%;
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }
  .text h2{
    color:#FFF;
  }
  .column:hover .text {
    transform: translateY(0);
  }
  .column:hover .image {
    transform: scale(1.1);
  }
  .cta-button {
  display: inline-block;
  background-color: #007bff;
  color: #ffffff;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.cta-button:hover {
  background-color: #0056b3;
}

</style>
<div class="container">
  {% for block in section.blocks %}
    <div class="column" style="width: {{ block.settings.width }}px;">
      <img
        class="image"
        src="{{ block.settings.image | img_url: 'large' }}"
        alt="{{ block.settings.image.alt }}"
        width="{{ block.settings.width }}"
        height="{{ block.settings.height }}"
      >
      <div class="text">
        <h2>{{ block.settings.heading }}</h2>
        <p>{{ block.settings.text }}</p>
        <a href="{{ block.settings.button_link }}" class="cta-button">{{ block.settings.button_label }}</a>
      </div>
    </div>
  {% endfor %}
</div>

{% schema %}
{
  "name": "Hover Image",
  "class": "section",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [



  ],
  "blocks": [
    {
      "type": "heading",
      "name": "t:sections.image-with-text.blocks.heading.name",
      "limit": 2,
      "settings": [
        {
      "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": "medium",
          "label": "t:sections.image-with-text.settings.height.options__3.label"
        },
        {
          "value": "large",
          "label": "t:sections.image-with-text.settings.height.options__4.label"
        }
      ],
      "default": "adapt",
      "label": "t:sections.image-with-text.settings.height.label"
    } ,
        {
          "type": "inline_richtext",
          "id": "heading",
          "default": "Image with text",
          "label": "t:sections.image-with-text.blocks.heading.settings.heading.label"
        },
         {
          "type": "text",
          "id": "button_label",
          "default": "Button Label",
          "label": "Button Label"
        },
         {
          "type": "url",
          "id": "button_link",
          "label": "Button Link"
        }



      ]
    }


  ],
  "presets": [
    {
      "name": "t:sections.image-with-text.presets.name",
      "blocks": [
        {
          "type": "heading"
        }
      ]
    }
  ]
}
{% endschema %}

Hope this will help you.

Regards
Shopidevs

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

HDL-Shin
Shopify Partner
80 20 16

Hi @Samer1
You can use image banners to do this

HDLShin_0-1715522290804.png

Hope this can help you
Kind regards, 

HDL-Shin

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
♥️♥️♥️ HDL-Shin || Shopify Partner ♥️♥️♥️
Samer1
Shopify Partner
4 0 0

@HDL-Shin  & @Arif_Shopidevs  both solutions worked perfectly!!!

You guys are the best!

 

@HDL-Shin  is there a way to hide only the second photo on mobile?

HDL-Shin
Shopify Partner
80 20 16

Hi @Samer1 , pls try code in your theme and check it in storefront

@media (max-width: 749px) {
  .banner__media.media.banner__media-half:nth-child(2) {
    display: none !important;
  }
}

HDLShin_0-1715606594469.png

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍😍

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
♥️♥️♥️ HDL-Shin || Shopify Partner ♥️♥️♥️