Hey guys!
I’m back again with another question please… I’m not a Wix developer but have some knowledge on how things work!
I’m using the Wix Editor.
FOR CONTEXT
I have different dynamic pages for different categories of a photography portfolio that allow users to filter via the selection tags on desktop.
For example:
Jewellery Photography (Dynamic Page)-> Filter by Brand Name
Fashion Photography (Dynamic Page)-> Filter by Brand Name
…and the photos in the pro gallery change based on what they’ve chosen.
When each of these filters are selected, the URL updates to www.example.com/jewellery-photography?brand+name+1, meaning I can link to the brands externally now which is great!
However on mobile, I don’t want this functionality as I’d like users to see all images on the page when they arrive, and so I have created sections for each brand with Pro Gallery sliders that are hidden on desktop. I have used section URLs so the links to these are like:
www.example.com/jewellery-photography#brand+name+1
THE PROBLEM
On the home page, I have a big Pro Gallery of mixed photos taken, and each image links to the dynamic page but filtered with the relevant brand of the link they clicked on. For example clicking on an image that has the link www.example.com/jewellery-photography?brand+name+1 will take them to all photos of that brand on desktop. Obviously this doesn’t work for mobile because I’ve done it differently so I’ve been trying to find a way I can make this work on both.
I’ve been looking into redirecting the link on mobile but I have no idea how I would do it.
The redirect on mobile would need to go from:
www.example.com/jewellery-photography?brand+name+1
to
www.example.com/jewellery-photography#brand+name+1
so that it scrolls down to the relevant brand gallery on mobile. I feel like I have over complicated this a bit, but I’m pretty deep in there now and I’m just wondering if anyone out there has achieved similar?
I found the code below:
import wixWindow from 'wix-window';
if(wixWindow.formFactor === "Mobile"){
[REDIRECT CODE HERE]
}
As this is a bit more complex than simply redirecting a page on mobile, I’m wondering if there’s a way to manually redirect an internal link on the page to the other within this using the mobile page code above? Is this even possible? I was hoping to put in the masterPage.js so that it works site-wide. Any other ideas would be totally welcome too.
Thanks so much in advance!