Zitat:
Zitat von denizYoshi
|
Das hast du doch in deinem Code gemacht? Oder was meinst du mit intialisieren?
Code:
if($("#map").length)
{
//google map
var coordinate = new google.maps.LatLng(50.044858, 8.164307);
var coordinate2 = new google.maps.LatLng(50.045694, 8.157946);
var content1 = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">Wunschtext</h1>'+
'<div id="bodyContent">'+
'<p><b>wurschtelt</b>, Blabla</b>, blabla ' +
'</div>'+
'</div>';
var content2 = '<div id="content2nd">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading"> Wunschtext 2</h1>'+
'<div id="bodyContent">'+
'<p><b> Wunschtext 2</b>, blabla</b>, blablabla ' +
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: content1
});
var infowindow2 = new google.maps.InfoWindow({
content2nd: content2
});
var mapOptions = {
zoom: 16,
center: coordinate,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControl: false,
scrollwheel: parseInt($("#map").data("scroll-wheel"), 10),
draggable: parseInt($("#map").data("draggable"), 10),
styles: [ { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#8ccaf1" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "elementType": "labels", "stylers": [ { "color": "#ffffff" }, { "visibility": "simplified" } ] } ]
};
map = new google.maps.Map(document.getElementById("map"),mapOptions);
//1 Ort
marker = new google.maps.Marker({
position: new google.maps.LatLng(50.044858,8.164307),
map: map,
icon: new google.maps.MarkerImage("images/map_pointer.png", new google.maps.Size(38, 48), null, new google.maps.Point(18, 48))
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
//2 Map Ort
marker2 = new google.maps.Marker({
position: new google.maps.LatLng(50.045694, 8.157946),
map: map,
icon: new google.maps.MarkerImage("images/map_pointer.png", new google.maps.Size(38, 48), null, new google.maps.Point(18, 48))
});
marker2.addListener('click', function() {
infowindow2.open(map, marker2);
});
map.addOverlay(marker);
map.addOverlay(marker2);
}