I think I am after a solution to a similar question. Can I have embed code that will not change the layout of the gallery or of any of its content but is set to open with a specific category - Wales Outdoors | Amazing Accommodation To Stay In Wales - so set to open, for example, with category Elan Valley
Hi there, @Andy_Lamb
I’ve forwarded your request to the devs and will update you once the solution is ready
2 Likes
Thank you Max
2 Likes
Here is a script from the devs:
const DEFAULT_TAB = 'Cardiff & South East Wales';
const waitForElement = (selector, root = document) =>
new Promise((res) => {
let i = 0;
const check = () => {
const component = root.querySelector(selector);
if (component) {
res(component);
} else if (i !== 50) {
setTimeout(check, 100);
i++;
}
};
check();
});
waitForElement('.eapp-photo-gallery-category-list-component').then(({ childNodes: tabs }) => {
tabs.forEach((tab) => {
if (tab.textContent.toLowerCase() === DEFAULT_TAB.toLowerCase()) {
tab.click();
}
});
});
Set the name of the needed category in the 1st line of the code, and add the resulted code to the Custom JS field on the Style tab of your widget’s settings:
Test it out and let me know if it helped
3 Likes
Thank you Max, that works really well as it does what I wanted and also improves load speed as not so many items are gathered. Thank you for the amazing service!
2 Likes
Perfect, thank you so much for the feedback!
If anything else comes up, we’re always here to help
1 Like