Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- google.maps.event.trigger(map,'resize',{});
- google.maps.event.addListener(marker, 'click', function() {
- //My Google Map Code
- });
- <script>
- var map;
- function initMap() {
- var map = new google.maps.Map(document.getElementById('map'), {
- zoom: 5,
- center: {lat: -34.397, lng: 150.644}
- });
- var geocoder = new google.maps.Geocoder();
- geocodeAddress(geocoder, maps);
- }
- function geocodeAddress(geocoder, resultsMap) {
- var address = "Ahmedabad India";
- geocoder.geocode({'address': address}, function(results, status) {
- if (status === 'OK') {
- resultsMap.setCenter(results[0].geometry.location);
- var contentString = '<div id="content">'+
- '<div id="siteNotice">'+
- '</div>'+
- '<h1 id="firstHeading" class="firstHeading">Websters House</h1>'+
- '<div id="bodyContent">'+
- 'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
- 'Aboriginal people of the area. It has many springs, waterholes, '+
- 'rock caves and ancient paintings. Uluru is listed as a World '+
- 'Heritage Site.</p>'+
- '<p>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).</p>'+
- '</div>'+
- '</div>';
- var infowindow = new google.maps.InfoWindow({
- content: contentString
- });
- var marker = new google.maps.Marker({
- title: 'Uluru (Ayers Rock)',
- map: resultsMap,
- position: results[0].geometry.location
- });
- //Call Listner On Click Markre
- marker.addListener('click', function() {
- infowindow.open(map, marker);
- });
- } else {
- alert('Geocode was not successful for the following reason: ' + status);
- }
- });
- }
- </script>
- <script async defer src="https://maps.googleapis.com/maps/api/js?key=XXXXXXMYKEYXXXX&callback=initMap"></script>
Add Comment
Please, Sign In to add comment