2014-09-26 54 views
-1

嘿傢伙我現在正在建立一個新的網站,而且我快完成了,但有一件事情我想要更改。在wordpress模板中更改google標記

其屬性網站與谷歌地圖由每個屬性,我想知道如何更改谷歌地圖標記。例如鏈接property page

我發現在一個custom.js這一行,我可以改變它的縮放但沒有選擇改變標記`if($(「div#single-gmap」)。length){

var $title = $("div#single-gmap").data("title"); 

    var $lat = $("div#single-gmap").data("lat"); 
     $lat = ($.trim($lat).length > 0 ) ? $lat : "-37.80544394934272"; 

    var $lng = $("div#single-gmap").data("lng");  
     $lng = ($.trim($lng).length > 0) ? $lng : "144.964599609375"; 

    var myLatlng = new google.maps.LatLng($lat,$lng); 
    var mapOptions = { 
     zoom: 15, 
     center: myLatlng, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
    }` 

回答

0

How do you create a Marker with a custom icon for google maps API v3?

在MapOptions變量後加入此...

var marker; 
marker = new google.maps.Marker({ 
    map:map, 
    // draggable:true, 
    // animation: google.maps.Animation.DROP, 
    position: new google.maps.LatLng(59.32522, 18.07002), 
    icon: 'http://cdn.com/my-custom-icon.png' // null = default icon 
    }); 

只要改變圖像路徑和經度和緯度基於根據您的要求。

+0

你的意思是這個http://jsfiddle.net/4Luo3rpy/? 它沒有工作, 這裏是這個文件的完整JS http://jsfiddle.net/a50ntdzv/ 我發佈的行是在行273 – 2014-09-26 08:13:21

+0

修復它:)謝謝 – 2014-09-26 08:30:01