This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Google Maps Marker Infobox

Resolved 6 replies pluginplugin-page-builder
10 years ago · Last reply by Andrew Misplon 10 years ago

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!

URL: http://heikewanke.berlin/kontakt/

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

6
  1. Andrew Misplon Staff 10 years, 5 months ago

    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.

  2. Sven Tenscher 10 years, 5 months ago

    Andrew,

    This sounds once more just awesome.

    Will wait for the update!

    Thanks for your support!

  3. Andrew Misplon Staff 10 years, 5 months ago

    Great timing :)

    The guys are working there way through one or two polishes. We’ll have this out ASAP!

  4. Andrew Misplon Staff 10 years, 5 months ago

    After it’s released, give the new feature a test and let us know how it goes. Thanks :)

  5. Sven Tenscher 10 years, 5 months ago

    Tested it …

    it works like a charm and so easy to use … just GREAT!

    Thank you for this great product

  6. Andrew Misplon Staff 10 years, 5 months ago

    Awesome :) Thanks for your feedback. I’ll pass it onto the team. Much appreciated.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread