2012-11-09 65 views
1

我在我的谷歌地圖上有一些標記,一些標記在另一個標記的陰影下。陰影中的標記不起作用。我如何去除陰影或任何其他解決方案。如何在JavaScript中刪除谷歌地圖上的標記陰影?

在此先感謝。

enter code here 
function createMarker(){ 
        var s; 
         for (var i = 0, j=0; i < markers_array.length; i++, j++) { 
    // obtain the attribues of each marker 
          var lat = parseFloat(markers_array[i][0]); 
          var lng = parseFloat(markers_array[i][1]); 
          //alert(markers_array[i][2]); 
          //alert(markers_array[i][3]); 
          var trailhead_name = markers_array[i][2]; 
          var trailhead_name1 = markers_array[i][3]; 
          var image = markers_array[i][4]; 

          var myLatlng = new google.maps.LatLng(lat, lng); 

          var contentString = trailhead_name; 
          var contentString1= trailhead_name1; 
          var marker=[]; 
          marker[i] = new google.maps.Marker({ 
           position: myLatlng, 
           map: map, 
           icon: image, 
           clickable: true, 
           title:markers_array[i][5], 

           }); 
          google.maps.event.addListener(map, 'click', function(e) { 

          infobox.close(); 
          infobox1.close(); 
          infobox2.close(); 

          }); 


          marker[i]['infowindow'] = contentString; 
          marker[i]['infowindow1']= contentString1; 
          global_markers[i] = marker[i]; 



          var la; 
          var lt; 
          google.maps.event.addListener(global_markers[i], 'click', function(e) { 
          infobox.close(); 
          infobox1.close(); 
          infobox2.close(); 
          la=this.getPosition().lat(); 
          lt=this.getPosition().lng(); 
           infobox.setPosition(e.latLng); 
           infobox.setContent(this['infowindow']); 
           infobox.boxStyle_ = { 
             background: "url('images/tipbox.gif') no-repeat scroll 0 0 #E1E3E4", 

             width: "270px" 
            }; 
           infobox.open(map); 
           var title=this.title; 
           s=this['infowindow1']; 
           $(document).delegate("#content", "mouseenter touchstart", function() { 
           map.setOptions({ 
           draggable: false, 
           scrollwheel: false 
           }); 




           }); 

          $(document).delegate("#content", "mouseleave touchend", function() { 
           map.setOptions({draggable: true,scrollwheel: true}); 


          }); 
          }); 
          } 
+0

檢查此網址 - http://stackoverflow.com/questions/4201804/how-can-i-remove-the-shadow-on-the-markers-on-my-map –

回答

1

您需要創建和使用MarkerImage類的圖標和陰影,然後使用標記和的setIcon方法setShadow您的活動期間放大版交換他們。放大的MarkerImage類需要使用scaledSize屬性。這將圖像回覆到您的MarkerImage大小屬性

這裏的大小是這個動作小提琴例如:check

var shadow = new google.maps.MarkerImage(
    beachflagShadowUrl, 
    // The shadow image is larger in the horizontal dimension 
    // while the position and offset are the same as for the main image. 
    new google.maps.Size(37, 32), 
    new google.maps.Point(0,0), 
    new google.maps.Point(0, 32)); 

或檢查this

chst=d_map_pin_icon[_withshadow] 
chld=<icon_string>|<fill_color> 

seethis

+0

我們不能完全消除陰影嗎? – gurusai

+0

如果你把一些代碼我可以幫你ü – Gadde

+0

plz檢查代碼 – gurusai