bjorn2404 / jQuery-Store-Locator-Plugin

A store locator plugin using Google Maps API version 3
MIT License
495 stars 235 forks source link

Start with marker's info window open? #292

Closed sm-mdp closed 1 year ago

sm-mdp commented 1 year ago

Hi there. I'm trying to find a way to have the InfoWindow open when the page loads rather than requiring someone to click on the marker. This is in an instance where there's only one location on the map. Having some trouble sorting this one out.

Thank you, Sharon

sm-mdp commented 1 year ago

I was able to get this working finally. I added 'openNearest' and think I had too many other settings that might've been conflicting.

For anyone else, here's the code I'm using. I've set the defaultLat and defaultLng as the same for the singular location I'm wanting to display.

<script> jQuery(function($) { $("#location-full-map-container").storeLocator({ dataType: "json", dataRaw: ######, autoCompleteDisableListener: true, autoCompleteOptions: { placeId: "######", fields: ["place_id", "geometry", "name"], }, autoGeocode: true, distanceAlert: -1, defaultLat: ######, defaultLng: ######, defaultLoc: true, openNearest: true, slideMap: false, }); }); </script>