How to Rotate Header Images on Page Refresh in Dawn Theme?

How to Rotate Header Images on Page Refresh in Dawn Theme?

Niklas10B
Visitor
3 0 0

 

I want to modify the header image functionality in the Dawn theme so that I can select multiple images in the Theme Editor, and have a different one displayed each time the page is refreshed.

Currently, I can choose a single header image through the Theme Editor, but I would like to extend this functionality to allow selecting multiple images, just like I do for the current header image. Then, on each page load, one of these images should be randomly displayed.

I would appreciate guidance on the best approach to implement this using Liquid and JavaScript while keeping the image selection manageable within the Theme Editor.

  • Add a function that randomly switches the banner image on each page load.
  • Allow selection of up to 5 images in the Theme Editor using the image picker.

    Thank you!

 

10b - målminutter.dk
Replies 4 (4)

Iamisabella
New Member
5 0 0

You need to make the changes in the store theme liquid before you can modify it in the theme editor

For further assistance, click here.
If you found my solution helpful, like and accept it as a solution.
regards,
Isabella.
Niklas10B
Visitor
3 0 0

Hi Iamisabella, 

Yes, I know that, but how is that achievable? Can you help with that? 

10b - målminutter.dk

Shadab_dev
Shopify Partner
1246 64 131

This sounds fun, i will give you that. Haven't done a project of this sort yet but yes it is certainly achievable with theme code modifications using html, css and certainly liquid.

 

Please reach out via personal links below for a convenient conversation and collaboration.

Buy me Coffee, if you feel i was helpful. Email Me here or WhatsApp me with this link for any help with shopify theme customizations or any project in web dev. If this is helpful, please Like and Accept the solution.
Niklas10B
Visitor
3 0 0

Thank you! 😉 I will reach out. 

10b - målminutter.dk