2016-04-30 15 views
0

:)単純なマーカー落とし関数の引数としてアイコンを渡そうとしていますが、一重引用符と二重引用符の両方を試しました。だから私は次の関数とそれを使用するコードを持っています。アイコンを引数として渡しても動作しません - google maps

function addMarkerWithTimeout(position, the_image, timeout) { //Marker dropping function 
    window.setTimeout(function(the_image) { 
    markers.push(new google.maps.Marker({ 
     position: position, 
     map: map, 
     draggable: false, 
     icon: the_image,  //Hard-typing the url here works perfectly 
     scale: 3, 
     animation: google.maps.Animation.DROP })); 
    }, timeout); 
} 

var start_image = '../icons/favicon.ico';      //The icon local url 
addMarkerWithTimeout(routeCoordinates[0], start_image, 200); //Calling the function 

答えて

1

トリックをしたwindow.setTimeoutは

function addMarkerWithTimeout(position, the_image, timeout) { //Marker 
    window.setTimeout(function() { 
+0

からthe_imageを削除します。どうもありがとうございました。 –

関連する問題