featured image link not working

LewisWaters
New Member
2 0 0

hello, I've used some code to show different images dependent on device, however now when I place a link in the menu box, it doesn't work when you click on the photo. any help would be appreciated. please see code below.

{%- if section.settings.full_width -%}
{%- assign full_width = true -%}
{%- endif -%}

<style>
.hidden_desktop{
display:block;
}
.hidden_mobile {
display: none;
}
@media (min-width:992px){
.hidden_desktop{
display:none;
}
.hidden_mobile {
display: block;
}
}
</style>
<div class="velaBanner" style="{% if section.settings.margin_block !=blank %}margin:{{section.settings.margin_block}}; {% endif %}
{% if section.settings.padding_block !=blank %}padding:{{section.settings.padding_block}}; {% endif %}">
<div class="container{% if section.settings.full_with %}-full{% endif %}">
<div class="{{ section.settings.effect }}">
{% if section.settings.link != blank %}<a href="{{ section.settings.link }}" title="{{ block.settings.image.alt | default: shop.name }}">{% endif %}
{% if section.settings.image != blank %}
<img class="img-responsive hidden_mobile" alt="{{ section.settings.image.alt | default: shop.name }}" src="{{ section.settings.image | img_url: '2000x' }}" />
{% else %}
<img class="img-responsive hidden_mobile" alt="{{ shop.name }}" src="//placehold.it/{{ section.settings.image_size }}" />
{% endif %}
{% comment %}Above will be the desktop image and below will be the mobile image{% endcomment %}
{% if section.settings.mobile_image != blank %}
<img class="img-responsive hidden_desktop" alt="{{ section.settings.image.alt | default: shop.name }}" src="{{ section.settings.mobile_image | img_url: '992x' }}" />
{% else %}
<img class="img-responsive hidden_desktop" alt="{{ shop.name }}" src="//placehold.it/{{ section.settings.image_size }}" />
{% endif %}
{% if section.settings.link != blank %}</a>{% endif %}
</div>
</div>
</div>

{% schema %}
{
"name": "Featured image",
"class": "featured-image-section",
"settings": [
{
"type": "checkbox",
"id": "full_width",
"label": "Full width",
"default": true
},
{
"type": "image_picker",
"id": "image",
"label": "Desktop image"
},
{
"type": "image_picker",
"id": "mobile_image",
"label": "Mobile image"
},
{
"type": "select",
"id": "section_style",
"label": "Section style",
"default": "section-blank",
"options": [
{
"value": "section-blank",
"label": "Blank background"
},
{
"value": "section-default",
"label": "Accent background"
},
{
"value": "section-border",
"label": "Border top"
}
]
},
{
"type": "url",
"id": "image_link",
"label": "Link"
}
],
"presets": [
{
"name": "Featured image",
"category":"Image and text"
}
]
}
{% endschema %}

 

0 Likes