Is it possible to change the default view to ‘Map View’ instead of ‘List View’ on the Store Locator Widget?
1 Like
@Max Can you please add an option to select the default view on the mobile?
1 Like
Hi there, @Boxon
We’ve added this code to the Custom JS field on the Settings tab of your widget’s setting to make the map view default on mobile:
function listener(selector, callback) {
if (window.innerWidth > 480) {
return;
}
const firstTarget = document.querySelector(selector);
if (firstTarget) {
return callback(firstTarget);
}
const observer = new MutationObserver((_, observer) => {
const targetNode = document.querySelector(selector);
if (targetNode) {
observer.disconnect();
callback(targetNode);
}
});
observer.observe(document.body, { childList: true, subtree: true });
}
listener(
'[class*="mobile-layout__Container-sc"] [class*="FloatingButton__FloatingButtonContainer-sc"] [class*="ButtonBase__ButtonContainer-sc"]',
(button) => {
requestAnimationFrame(() => {
button.click();
});
}
);
Check it out and let me know if you like the result
1 Like
Hey @Max,
I’m thinking this code wouldn’t fix this issue, View Map Button Issue - Mobile View ?
Best wishes,
mw
1 Like
@Master_Web Yep, this code helps display the map by default instead of the location list.
However, I’ve responded to you in this thread
1 Like