i new in google map..
i load multiple marker , infowindow in google map database..
i have problem load infowindow when load marker twice,first infowindow display too,so have 2 infowindow in 1 marker....
my code is:
function movemarker() { document.getelementbyid("koordinatnya").innerhtml = "move marker"; get('movemarker', function(data) { //loop marker difference lat,long var obj = json.parse(data); var items = object.keys(obj); var output=''; markers[item] = markers[item] || new google.maps.marker({ map: map, icon:"http://localhost/pinmarker/usermarker.png" }); markers[item].setposition(new google.maps.latlng(obj[item].latitude,obj[item].longitude)); var boxtext = document.createelement("div"); boxtext.style.csstext = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;"; boxtext.innerhtml = obj[item].user.tostring(); var cus_info= { content: boxtextinfo ,disableautopan: false ,maxwidth: 0 ,pixeloffset: new google.maps.size(-5, 0) ,zindex: null ,boxstyle: { background: "url('tipbox.gif') no-repeat" ,opacity: 0.90 } ,closeboxmargin: "2px 2px 2px 2px" ,closeboxurl: "http://www.google.com/intl/en_us/mapfiles/close.gif" ,infoboxclearance: new google.maps.size(1, 1) ,ishidden: false ,pane: "floatpane" ,enableeventpropagation: false }; var ibinfo = new infobox(cus_info); google.maps.event.addlistener(markers[item], 'click', function() { ibinfo.open(map, markers[item]); //infowindow opened }); }); }
html code :
<html> <head> </head> <body> <script src="socket.io/socket.io.js"></script> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <link href="http://localhost/cssjsx/cssx.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="http://localhost/cssjsx/jsx.js"></script> <script type="text/javascript" src="http://localhost/cssjsx/infobox.js"></script> <div class="googlemap"> <div id="header">header : ltv@gmail.com</div> <div id="ltk_mn">menu</div> <div id="map_area"> <div id="map_canvas"></div> <div class="text"> <br /> <input type="text" id="from" placeholder="asal"/> <input type="text" id="to" placeholder="tujuan"/> <select id="mode"> <option value="driving">driving</option> <option value="walking">walking </option> <option value="bicycling">bicycling</option> </select> <input type="button" value="show route" id="driveit" /> <br/> <div id="testkordinat" onclick="">test koordinat</div> <div id="koordinatnya" onclick="">koordinatnya</div> <div id="chatbox" onclick="">test chtbox</div> <a href="http://localhost/get_locations.php">testt link</a> <input type="text" id="idglobal" style="display: none;" value="ltv@gmail.com" /> </div> </div> <div id="kotak_profile">kotakprofile</div> <div id="panelkiri"></div> <div id="directions"></div> </div> </body> </html>
i want each infowindow display 1 in 1 marker..how achive that?
thanks..
Comments
Post a Comment