我正在尝试将自定义图像添加到此代码上的标记,但我不知道如何。我尝试添加新的 var z 并放入图像中,但它不起作用。我发现了越来越多类似的代码,但这看起来很简单,而且我在这个领域很新,我想从不那么复杂的东西开始。
我在这里找到了这段代码:http: //stiern.com/tutorials/adding-custom-google-maps-to-your-website/
function initialize() {
var map_options = {
center: new google.maps.LatLng(45.813029,15.977895), <!-- centar mape -->
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var google_map = new google.maps.Map(document.getElementById("map_canvas"), map_options);
var info_window = new google.maps.InfoWindow({
content: 'loading'
});
var t = [];
var x = [];
var y = [];
var h = [];
t.push('Klinček');
x.push(45.812619);
y.push(16.007195);
h.push('<p><strong>Caffe bar Klinček</strong><br/>Cijena: 15kn (Ožujsko točeno)<br/> Adresa: Kušlanova 52</p>');
var i = 0;
for ( item in t ) {
var m = new google.maps.Marker({
map: google_map,
animation: google.maps.Animation.DROP,
title: t[i],
position: new google.maps.LatLng(x[i],y[i]),
html: h[i]
});
google.maps.event.addListener(m, 'click', function() {
info_window.setContent(this.html);
info_window.open(google_map, this);
});
i++;
}
}
初始化();