Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle maps external marker link
    text
    copied!<p>I'm using google maps and trying to make some external link markers. I'm loading it with async and then trying to make markers that have external links that can then be clicked on to animate to the markers. What I have isn't quite working, but I think it's close. I was also wondering how to do this w/ jquery? I think part of the issue is I don't have access to the body tag so I can't do and I'm not sure how to otherwise do it.</p> <pre><code>function initialize() { var mapOptions = { zoom: 8, center: new google.maps.LatLng(-34.397, 150.644), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); } function loadScript() { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://maps.googleapis.com/maps/api/js?sensor=false&amp;' + 'callback=initialize'; document.body.appendChild(script); } window.onload = loadScript; var marker1; var marker2; function initialize() { var latlng = new google.maps.LatLng(26.032260, 50.514686); var myOptions = { zoom: 15, center: latlng, mapTypeId: google.maps.MapTypeId.HYBRID }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var infowindow = new google.maps.InfoWindow(); marker1 = new google.maps.Marker({ position: new google.maps.LatLng(41.569690, 2.257090), map: map, title: 'Barcelona' }); google.maps.event.addListener(marker1, 'click', function() { infowindow.setContent('Spanish Grand Prix'); infowindow.open(map, marker1); }); marker2 = new google.maps.Marker({ position: new google.maps.LatLng(31.338463, 121.220355), map: map, title: 'Shanghai'}); google.maps.event.addListener(marker2, 'click', function() { infowindow.setContent('Chinese Grand Prix'); infowindow.open(map, marker2); }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload