Google Maps: How to expand location panel on mobile

By default, the location panel in Google Maps is collapsed on mobile, showing only 1 location from the list:


However, if you prefer to have it expanded right from the start, just add this script right after your widget installation code and you’ll be good:

<script>
  const waitForElement = (selector, callback, step, limit) => {
    const currentStep = step || 300;
    const currentLimit = limit || 5000;
    let remainingTime = currentLimit;
    const intervalId = setInterval(function () {
      const targetElement = document.querySelector(selector);
      if (targetElement || remainingTime <= 0) {
        clearInterval(intervalId);
        if (targetElement && typeof callback === "function") {
          callback(targetElement);
        }
        return;
      }
      remainingTime -= currentStep;
    }, currentStep);
  };

  waitForElement(".eapps-google-maps-map-container", (block) => {
    const widgetBlock = block.closest("[class*='elfsight-app']");
    const isOpened = widgetBlock.classList.contains(
      "eapps-google-maps-bar-opened"
    );

    if (!isOpened) {
      widgetBlock.classList.add("eapps-google-maps-bar-opened");
    }
  });
</script>

Got any issues or questions? Describe your use case in the comments and we’ll be happy to help :wink: