Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Hi,
I would like to have an Infobox appear one someone clicks on a marker on the Google Maps page.
Found this example code at Google for this type of behavior but I have no idea what file I have to modify
function initMap() { var uluru = {lat: -25.363, lng: 131.044}; var map = new google.maps.Map(document.getElementById('map'), { zoom: 4, center: uluru }); var contentString = '<div id="content">'+ '<div id="siteNotice">'+ '</div>'+ '<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+ '<div id="bodyContent">'+ '<b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' + 'sandstone rock formation in the southern part of the '+ 'Northern Territory,.... '+ 'Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+ 'https://en.wikipedia.org/w/index.php?title=Uluru</a> '+ '(last visited June 22, 2009). '+ '</div>'+ '</div>'; var infowindow = new google.maps.InfoWindow({ content: contentString }); var marker = new google.maps.Marker({ position: uluru, map: map, title: 'Uluru (Ayers Rock)' }); marker.addListener('click', function() { infowindow.open(map, marker); }); }
also I found this example code opening and closing the infobox on a mouse over.
google.maps.event.addListener(CalMarker, 'mouseover', function() { //open the infowindow when it's not open yet if(contentStringCal!=infowindow.getContent()) { infowindow.setContent(contentStringCal); infowindow.open(map,CalMarker); } }); google.maps.event.addListener(CalMarker, 'click', function() { //when the infowindow is open, close it an clear the contents if(contentStringCal==infowindow.getContent()) { infowindow.close(map,CalMarker); infowindow.setContent(''); } //otherwise trigger mouseover to open the infowindow else { google.maps.event.trigger(CalMarker, 'mouseover'); } }); //clear the contents of the infwindow on closeclick google.maps.event.addListener(infowindow, 'closeclick', function() { infowindow.setContent(''); });
I thank you once more for your great product and support. You are awesome!
Hi Sven
Thanks for your support and feedback, it’s most appreciated.
This feature is about to be included in the Widgets Bundle. We’re busy testing at the moment. Users will be able to choose to display on click/hover/always.
Keep an eye out. We should be pushing live in a couple of days.
Andrew,
This sounds once more just awesome.
Will wait for the update!
Thanks for your support!
Great timing :)
The guys are working there way through one or two polishes. We’ll have this out ASAP!
After it’s released, give the new feature a test and let us know how it goes. Thanks :)
Tested it …
it works like a charm and so easy to use … just GREAT!
Thank you for this great product
Awesome :) Thanks for your feedback. I’ll pass it onto the team. Much appreciated.