Funktioniert das Defer-Attribut nicht mit der Google Maps API?HTML

HTML-Programmierer
Anonymous
 Funktioniert das Defer-Attribut nicht mit der Google Maps API?

Post by Anonymous »

Ich versuche sicherzustellen, dass die Google-Karte als letztes auf der Seite geladen wird und sich nicht negativ auf die Leistung der Seite auswirkt.

Wenn das Defer-Attribut nach ...sensor=false" platziert wird, wird die Karte nicht angezeigt. Wie lässt sich das Defer-Attribut am besten mit Google Maps verwenden? Ist das überhaupt möglich?

Code: Select all



function initialize() {
var mapOptions = {
center: new google.maps.LatLng(37.7599446, -122.4212681),
zoom: 12,
panControl: false,
disableDefaultUI: true,
scrollwheel: false,
mapTypeControl: false,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
},
panControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);

var marker = new google.maps.Marker({
position: new google.maps.LatLng(37.7599446, -122.4212681),
map: map,
title: '805 Valencia St. San Francisco, CA'
});
var contentString = '' +
'' +
'' +
'805 Valencia St.
San Francisco, CA' +
'' +
'' +
'[list][*][email protected][*][email protected][*][email protected][/list]' +
'' +
'';

var infowindow = new google.maps.InfoWindow({
content: contentString,
maxWidth: 330
});

google.maps.event.addListener(marker, 'click', function () {
infowindow.open(map, marker);
});

}

google.maps.event.addDomListener(window, 'load', initialize);

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post