javascript - Multimarker and infoboxes for every marker -


i try make custom infobox. if run 1 marker, works, if try imgur (the array has got coordinates, name , other attributes every marker) have more 1 marker can't make work. shows first 1 marker , none else , no infobox.

here code:

for (i = 0; < imgar.length; i++) {      var location = new google.maps.latlng(imgar[i].coords.coordinates[1],                                           imgar[i].coords.coordinates[0]);      var marker = new google.maps.marker({                         position : location,                         map : map,                         icon : "icons/coffee1.png" ,                         animation : google.maps.animation.drop,                         infoboxindex :  // <--- that's attribute     });      var content = "<h5> name:" + imgar[i].name +                   "<br> description:" + imgar[i].description +                   "<br><img src='" + imgar[i].image +                   "' width='100px' height='100px'/> <h5>";      var var_infobox_props = {         content: content,         disableautopan: false,         maxwidth: 0,         pixeloffset: new google.maps.size(-10, 0),         zindex: null,         boxclass: "myinfobox",         closeboxmargin: "2px",         closeboxurl: "icons/close.png",         infoboxclearance: new google.maps.size(1, 1),         visible: true,         pane: "floatpane",         enableeventpropagation: false     };      var var_infobox = new infobox(var_infobox_props);      google.maps.event.addlistener(marker, 'mouseover',         function(event) {             map.panto(event.latlng);             map.setzoom(16);             infocoffee[this.infoboxindex].open(map, this);         }     );      // save infobox in array     infocoffee.push(var_infobox);      // save marker in array     markers.push(marker); }  markers.setmap(map); 

what not working? how can fix it?

it sounds either infocoffee.push(var_infobox); or markers.push(marker); results in error, , javascript stopped execute there (that's why have 1 markers.)

i reproduce on jsfiddle. take @ the working sample, , the sample error.

=-=-=- edited -=-=-=
same concept should apply infobox plugin, shown here.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -