javascript - View on Map Button: hot to activate a control? -
i'm having problems activating command in google maps, goal when click command want zoom in on marker in map , display associated infowindow.
here .html file
<div id="detailspanel"> <div id="adamsondetails"> <div id="aduimages"> <img src="img/doodle1.jpg"/> <img src="img/doodle2.jpg"/> <img src="img/doodle3.jpg"/> </div> <div id="infotab"> <div id="viewonmap" onclick="viewadu()">view on map</div> </div> </div> <div id="sicdetails"> <div id="sicimages"> <img src="img/sic1.jpg"/> <img src="img/sic2.jpg"/> <img src="img/sic3.jpg"/> </div> </div> <div id="homedetails"> <div id="homeimages"> <img src="img/home1.jpg"/> <img src="img/home2.jpg"/> <img src="img/home3.jpg"/> </div> </div> </div>
this javascript generates markers
for (var = 0; < manilaplaces.length; i++) { var place = manilaplaces[i]; var marker = new google.maps.marker({ position: new google.maps.latlng(place[1], place[2]), map: map, icon: placemarker, title: place[0], zindex: place[4] }); // add together marker array manilamarkers.push(marker); }
this 1 generates infowindow
function aduinfo() { var contentstring = '<div id="content">' + '<div id="sitenotice">' + '</div>' + '<h1 id="firstheading" class="firstheading"><img src="lodging.png"> adu</h1>' + '<div id="bodycontent">' + '<p>text here ' + 'text here</p>' + '</div>' + '</div>'; manilainfowindows[0] = new google.maps.infowindow({ content: contentstring }); var adumarker = manilamarkers[0]; //marker zoom , closing of other infowindow adumarker.setmap(map); google.maps.event.addlistener(adumarker, 'click', function () { map.setzoom(17); map.setcenter(adumarker.getposition()); manilainfowindows[0].open(map, adumarker); }); }
the function below code doesn't work note showmap() executes function shows map on screen including map.setzoom(17) doesn't execute 3rd row code
function viewadu() { showmap(); map.setzoom(17); map.setcenter(adumarker.getposition()); }
everything in code works except one, been trying figure out nil works.
javascript html google-maps google-maps-api-3
No comments:
Post a Comment