I'm trying to connect a button so that when it is clicked it will appear with the marker I created in association with the location on Google Maps (provided by Wix). I followed the code from Corvid Reference in regards to setting a map location info:
$w("#myGoogleMap").location = {
"latitude": 37.77065,
"longitude": -122.387301,
"description":"Wix Office"
};
and connecting it to my button:
export function button20_click(event) {
$w('#googleMaps2').location = {
"latitude": 32.7904,
"longitude": 79.9396,
"description": "Darling Oyster Bar"
};
}
Surprisingly it actually worked for that instance. But for every other button, it just defers back to this specific location in the code above. One of my markers even disappeared. Any reasoning on why this is happening? And how to fix it? Thanks!
Thanks for the response! Weirdly enough for me, I had to make the code first, which connected the location, and then add the multiple markers to the google maps.
I have a new problem now though where I put a website link to each marker (using the google maps settings). If I click a marker on the map it takes me to the right website. If you click the button that shows your location on the map and click the website associated with that location, it only takes you to my first created location website link... I'm not sure why it keeps deferring back to this first location, but I guess the code/button aren't really connected to the google maps marker? I've been trying to trouble shoot, but not sure what to do. Hopefully that makes sense.
Hey,
I've tested your code and it does work properly on my side (used it on 3 different buttons with 3 different locations). What exactly is not working for you? How can the issue be recreated?
Also, if you are trying to show multiple locations using Google Maps, you can refer to this example: https://www.wix.com/corvid/forum/wix-tips-and-updates/example-multiple-markers-google-maps