- Go to your Online store > Themes > Actions > Edit code
- Go to Section folder and open the main-product.liquid
- Find <slider-component> block and comment it out or delete it if you want
Comment it out by placing “<!--” before the slider-component and “-->” after the slider-component. Code should look like below
4. Before the commented out <slider-component>, add the code below
5. On the top part, paste the code below, and click SAVE
6. I see that the component-slider.css is also being use for multi-column section, therefore, we have to create a new .css file. Go to Asset folder, click 'create new asset', create blank. Name the file 'product-slider'. File should show like below
7. Now open, the created CSS folder and paste the code below.
8. Next, go back to the main-product.liquid. At the top part, comment out this code. You can also just delete it. To comment it out, place (<!-- ) before the code and (--->) after. Just like we did in the slider-component. Code should look like this.
add this after.
9. We need to go to the Asset folder again, and open global.js. Find the slider-component. Since slider component is a global code, meaning, some section also uses the same code. We have to add an if statement. Please disregard the video regarding this section in global.js.
At the SliderComponent constructor add the code below.
10. At the initPages function we need to change the totalPages. Replace the code below:
with this
11. Lastly, at the update function we need to change the currentPage, change the 1 into 4. Replace the code below, and click SAVE
to this
The global.js code should look like this:
That's it! You just transform the product page of Dawn theme. Let me know if you have questions or having issues with the code so we can fix it and have an updated code. (",)
Update 09/22/21: I end up changing the the code in the Asset/global.js so we do not break the slider component if we use it in the other section
I change the CSS code and remove the resize observer. Large-image will be the same height with the large-image-item.
Update 09/23/21: Issues of having two large image and slider missing fixed. Updated code to use feature hide_variants
Update 09/25/21: Fix the issue with thumbnail disappears when adding a section that uses a slider-component. Updated the code in the step #4.
Update 09/26/21: Added a video play button when thumbnail image is a video
Update 09/30/21: Fix the issue regarding the video button. Reposition the codes for the video-btn and added some css codes
Update 10/01/21: Fix the issue of stacking large images in mobile. I added a resizeObserver in the Javascript to fix the issue of big gaps between the large-image and the slider. If you don't want it you just delete the code
Update 10/03/21: Added overflow: hidden to large-image css. I would recommend not to have product images with extreme height as your first variant image. Also added some CSS so when active, thumbnail image will have border box and opacity is 1. See code in green. Thumbnail border color is dependent on your var(--gradient-base-accent-1).
Update 10/04/21: Change the v-btn in the product-slider.css file due to issue when having a mobile video
Update 10/10/21: I know I fix the issue regarding the space between the large image and the slider. I did remove the resizeObserver and also the padding-bottom of the large image to fix this. I updated the code
Update 10/11/21: I change how the border and opacity is applied. Please see the highlighted green code
Update 10/15/21: I added an onload function so when the window loaded the first image in the thumbnail will get the active property. Code is pink.
Also added a code for those who still want the option to hide the variants when variants selected. (NOTE: this is the original code from Dawn). See code in blue.
Copied!
46 comments
Hi @CLIMBINGMOUNTAINS. Have you tried adjusting your media in the product section? Make your first photo as the large media.
Thank you for the prompt reply made! Sorry if I wasn’t clear in my explanation. What I mean is, for example, in your video, the order of the bike pedals on your product slider is grey > red > white > black (see 6:24 in the video). What if I want the picture of the red pedal to appear as the first picture (e.g. in this order red > white > grey > black)?
I am selling something with 3 variants in red, blue and green colours. I have a total of 4 images (1 for each colours, and 1 that shows all 3 variants in the same photo). Currently, the first picture in my slider is the one for the red variant, followed by the photo with all 3 variants as the second picture in the slider. I want the photo with all 3 variants to appear as the first picture in the slider, but I’m having some difficulty doing so. I tried to reorder my pictures and variants from my shopify admin console, but that doesn’t seem to solve it.
One issue I met: if you have video in the slider, the play button won’t show on the slider thumbnail, so the customer won’t know it’s a video. Please look into this. Thanks
Hi, I was wondering, is it possible to re-order the sequence of photos that appear in the slider?