javascript - google map api with street view in infowindow not working -


I put my Google map in the link below, I have a problem because when I click on the marker, Only the final data from the string.

Can you help me?

You only need 1 infowindow to be declared for it (not). Notice: Only one id = "content" (ID is unique) can be.

Here's to think about it:

  • When the customer clicks on the marker, temporarily you store that marker in the current market; So you open infowindow it turns on infowindow.domready.

  • When the domain of infowindow is ready, then only you create new var pano, and you give it the position of current market (coordinates of both position window and Panoramic view) .

(Notice to other scripts: This requires the 'Marker Page' in the same folder as the index) Lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta name = "viewport" content = "initial-scale = 1.0, user-scalable = not" & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Complex icon & lt; / Title & gt; & Lt; Style & gt; HTML, body, # map-canvas {height: 100%; Margin: 0 px; Padding: 0 pixels} & lt; / Style & gt; & Lt; Script src = "https://maps.googleapis.com/maps/api/js?v=3.exp" & gt; & Lt; / Script & gt; & Lt; Script & gt; On LocationData = [[53.13,44 9, 18.04.292, "1. ul.Gajowa 99, 85-700 Bydgoszcz"], [53.03783, 18.61,368, "2. ul. Polna 17, 87-100 Torun "], [54.37,8 9, 18.5 9, 15 9," 3. ul. Partyzantów 70, 80-952 Gdańsk "], [50.23122, 18.99, 280 , "4. ul. Rolna 7, 40-555 Katowice"], [50.06358, 19.9 7,002, "5. Ul Cystersów 21, 31-553. Krakow"], [50.01,563 , 21.9 7702, "6. Ul. Matuszczaka 5, 35-083 Rzeszów"], [51.20651, 22.58,249, "7. Ul. Sierpinskiego 26, 20-448 Lublin"], [53.78,115, 20.50,410, "8. U. Towarowa 4, 10-417 Olsztyn"], [53.40, 99, 14.5 9, 046, "9. ul.Gdanska 15a, 70 -661 Szczecin "], [54.18, 99, 16.15,861," 10 ul. Bohaterów dub Lu WY 3, 75-211 Coszalin "], [52.22472, 20.93692," 11. ul.Sovinxigo 28, 01-105 Warszawa "]]; Function initialize () {var map = new google.maps.Map (document.getElementById ('map-canvas')); Var contentString = "& lt; Div id = "content" style = "width: 300px; height: 300px;" & Gt; & Lt; / Div & gt; '; Var range = new google.maps.LatLngBounds (); Var current marker = null; Var infowindow = new google.maps.InfoWindow ({content: contentString}); Google.maps.event.addListener (infowindow, 'domready', function () {var panorama = new google.maps.StreetViewPanorama (document.getElementById ("content"), {navigationControl: true, navigationControlOptions: {style: google. Maps .NavigationControlStyle.ANDROID}, enableCloseButton: false, addressControl: false, linksControl: true}) // infowindow.setPosition div points (for currentMarker.getPosition marker) (set info position of infoWindow); // set panoramic view The correct coordinates of the position pano.setPosition (Current Marker.getPosition ()); pano.setVisible (true);}); (Location id in place i) {var p = location data [i]; Var latlng = new google.maps.LatLng (P [0], p [1]); Bounds.extend (latlng); Var marker = new google.maps.marker ({status: latlng, map: map, title: page [2], icon: 'marker.png'}); Google.maps.event.addListener (Marker, 'Click', function () {currentMarker = this; // Store the marker that was clicked on infowindow.open (map, this);}); } Map.fitBounds (boundary); } Google.maps.event.addDomListener (window, 'load', start); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "map-canvas" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;


Comments