Can anyone help me to have a product image slider. My store theme is Dawn.
can you please share store url?
welcome to shopify community.
please share your store URL and if your store is password protected then please share your password also.
Thank you .
thanks for URL if you have able to code try this code
https://codepen.io/Turqueso/pen/rNNzpwb
if not familiar to code donât change the theme default you have to ask the theme support team, Shopify Expert or me
Where should i put this code??
its change product file css and js code all code changes on backend
@Abtiw4474 This has been a question Iâve seen so many others in the community ask since the Dawn theme has launched. So far this has been the closest solution Iâve seen. Hope this is able to help point you in the right direction
This guide was provided by user @shadowsfall118
I have achieved adding a slider to the product page images by using the slick slider.
Notes:
- This requires adding code and not editing any of the existing.
- The click to enlarge still works from the existing code.
- Works on mobile
There is 4 files to edit:
- main-product.liquid
- section-main-product.css
- header.liquid
- footer.liquid
Step 1: For main-product.liquid add the following and comment / remove the ââ start and end tags. Add the below code before the tag we removed or commented out.
{%- for media in product.media -%} {%- unless media.id == product.selected_or_first_available_variant.featured_media.id -%} {% render âproduct-thumbnailâ, media: media, position: forloop.index, loop: section.settings.enable_video_looping, modal_id: section.id, xr_button: true %} {%- endunless -%} {%- endfor -%} |
---|
Step 2: For section-main-product.css add the following to the bottom of the file
.slider { width: 80%; margin-left:auto; margin-right:auto; } .slick-slide { margin: 0px 20px; } .slick-slide img { width: 100%; } .slick-prev:before, .slick-next:before { color: black; } .slick-slide { transition: all ease-in-out .3s; opacity: .2; } .slick-active { opacity: .5; } .slick-current { opacity: 1; } |
---|
Step 3: For header.liquid add the following just after {%- endif -%} on line 9
Step 4: For footer.liquid add the following to the end of the file
How would you go about implementing something like this? Im familiar with coding html/css and js but i just donât understand how I would make it work for a shopify since they use the liquid templating language?
@made4Uo I was just testing my website after adding both the product slider and the collection slider. I noticed that for one of my products, the image sizes are different. I only have 3 images, so there is no slider. This has made the other images to display on top of the main image. Attaching the screenshot. Could you please let me know how/where I can edit the code so that the image list placement adjusts per the largest image size?
Your image height is more than 100%. I will take a look if I can change the image observer to initialize
@ KetanKumar I used your code but didnât work for me and also I didnât see any error in the console.
yes please share store url
something is wrong code please check again
@KetanKumar here is the code
{%- assign first_3d_model = product.media | where: âmedia_typeâ, âmodelâ | first -%}
{% assign current_variant = product.selected_or_first_available_variant %}
{% assign featured_media = current_variant.featured_media | default: product.featured_media %}
{% assign stacked = false %}
{% if section.settings.media_layout == âstackedâ %}{% assign stacked = true %}{% endif %}
{%- assign first_media = true -%}
{%- capture thumbnail_alt -%}
{%- if media.media_type == âvideoâ or media.media_type == âexternal_videoâ -%}
{{ âproducts.product.video_thumbnail_altâ | t: imageAlt: media.alt | escape }}
{%- elsif media.media_type == âmodelâ -%}
{{ âproducts.product.model_thumbnail_altâ | t: imageAlt: media.alt | escape }}
{%- else -%}
{{ âproducts.product.gallery_thumbnail_altâ | t: imageAlt: media.alt | escape }}
{%- endif -%}
{%- endcapture -%}
{% comment %}
Display a âView in your spaceâ button (multi) for the first visible media and each individual model.
Stacked layout only.
{% endcomment %}
{% if stacked %}
{%- assign xr_id = false -%}
{%- if first_media and first_3d_model -%}
{%- assign xr_id = first_3d_model.id -%}
{%- elsif media.media_type == âmodelâ -%}
{%- assign xr_id = media.id -%}
{%- endif -%}
{%- if xr_id -%}
{%- include âxr-buttonâ with model_id: xr_id, multi: true -%}
{%- endif -%}
{%- assign first_media = false -%}
{% endif %}
{% comment %}
Display a âView in your spaceâ button (single).
Stacked/Thumbnails layout (mobile)
Thumbnail layout only (desktop)
{% endcomment %}
{%- if first_3d_model -%}
{%- include âxr-buttonâ with model_id: first_3d_model.id, multi: false -%}
{%- endif -%}
{% unless stacked %}
-
{% for media in product.media %}
{% if product.media.size > 1 %}
-
{%- capture thumbnail_alt -%}
{%- if media.media_type == 'video' or media.media_type == 'external_video' -%}
{{ 'products.product.video_thumbnail_alt' | t: imageAlt: media.alt | escape }}
{%- elsif media.media_type == 'model' -%}
{{ 'products.product.model_thumbnail_alt' | t: imageAlt: media.alt | escape }}
{%- else -%}
{{ 'products.product.gallery_thumbnail_alt' | t: imageAlt: media.alt | escape }}
{%- endif -%}
{%- endcapture -%}
{%- if media.media_type == 'video' or media.media_type == 'external_video' or media.media_type == 'model' -%}
{% include 'svg-definitions' with media.media_type %}{%- endif -%}
{% endif %}
{% endfor %}
{{ product.vendor }}
{% endif %}{% comment %}
{{ product.title }}
{%endcomment%}{% assign current_variant = product.selected_or_first_available_variant %}
{{ current_variant.barcode }}
{%- if cart.taxes_included or shop.shipping_policy.body != blank -%}
{% capture âform_classesâ %}
product-single__form{% if product.has_only_default_variant %} product-single__formâno-variants{% endif %}
{%- endcapture %}
{% capture âform_idâ %}AddToCartFormâ{{ section.id }}{%- endcapture %}
{% form âproductâ, product, class:form_classes, id:form_id, data-product-form: ââ %}
{{ form | payment_terms }}
{% unless product.has_only_default_variant %}
{% for option in product.options_with_values %}
{% if section.settings.quantity_enabled %}
{% if section.settings.social_sharing_products %}
{% include âsocial-sharingâ, share_title: product.title, share_permalink: product.url, share_image: product.featured_media %}
{% endif %}
@KetanKumar yes maybe there is a mistake in pasting the code but the console is not showing any error
Please update your code. Transform you Dawn Theme in Debut theme product page for free.
Enjoy this features:
Product slider working.
Zoom feature working.
Variant buttons connected to the large image and the product slider.
Resize your thumbnail images.
No more massive images in the product page.
Check the code here for free. No app needed. Preview the video
Hi,
I just made a vertical carousel for the update theme version of Dawn theme. No app or external library needed. Check the video for more info
Hi I solved it following this video: https://www.youtube.com/watch?v=YQUhEsHV-hQ