I have working php script that stores the name and address of the company in variables. I then echo it out like this:
$(document).ready(function() {
$("#map").gmap3({
marker:{
address: "<?echo $coord;?>"
},
map:{
options:{
zoom:15,
mapTypeControl: true,
navigationControl: true,
scrollwheel: true,
streetViewControl: true
}
}
});
});
How would I add the name of the company to show below the marker? For example: this?
I tried to add:
marker:{
address: "<?echo $coord;?>"
title: "<?echo $com_name;?>"
}
But this doesn't work.
Thank you.
The title property must be inside option property.
var marker = {
latLng: [53.23564, 24.32654],
data: 'some data',
options: {
title: 'Title',
icon: '/Path/to/custom/icon/if/you/need.png'
}
}
Other information you can show with infowindow.
Example:
$(".gmap-widget .gmap3").gmap3({
action: "addMarkers",
markers: markers,
marker: {
events: {
click: function(marker, event, data){
var map = $(this).gmap3('get');
infowindow = $(this).gmap3({action:'get', name:'infowindow'});
if (infowindow){
infowindow.open(map, marker);
infowindow.setContent(data);
} else {
$(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: data, maxWidth: 300}});
}
}
}
}
});