Adding Multiple Markers with info windows having different text using jquery-ui-map -


i working on project use jquery-ui-map add multiple markers map. each marker have different info windows different text. when add them iterating array same text comes info windows. please me out ?. have been pulling hair on this.

$('#aroundmepage #map_canvas').gmap({'center': '-37.816945,144.953573', 'zoom': 12});  (var = 0, len = workoderlocalarray.length; < len; ++i) {        var workorder =workoderlocalarray[i];           var address = workorder.propertyaddress;          var coordinates = workorder.propertycoordinates;           $('#aroundmepage #map_canvas').gmap('addmarker', { 'position':coordinates }).click(function() {             $('#aroundmepage #map_canvas').gmap('openinfowindow', { 'content': coordinates }, this);           });      } 

i figured out. seems having issue closure. answers/fixes showing how solve issue using native javascript googl maps api,which lengthy solution/code, , not jquery-ui-map api.

following final code :

//function retuning info window click event function    function makeinfowindowevent(address) {           return function() {                       $('#aroundmepage #map_canvas').gmap('openinfowindow', { 'content': address }, this);             };       }   var workoderlocalarray = workordersobject.workorderarr;        (var = 0, len = workoderlocalarray.length; < len; ++i) {          var workorder =workoderlocalarray[i];           var address = workorder.propertyaddress;          var coordinates = workorder.propertycoordinates;           $('#aroundmepage #map_canvas').gmap('addmarker', { 'position':coordinates }).click(makeinfowindowevent(address));         } 

hope hopeful in future.cheers ;-).


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -