2015-12-15 94 views
0

我整合谷歌地圖。當我將鼠標懸停在標記上時,它顯示我在marker上的位置。但是我的問題是當我將鼠標懸停在標記地圖上時。我想,當我將鼠標懸停在標記位置應該是fixed.Here是我的代碼:修復谷歌地圖的大小

function CreateMarker(Obj){ 
      var $j=jQuery.noConflict(); 
      var pos; 
      var allMarkers = []; 
      pos = new google.maps.LatLng(Obj['latitude'], Obj['longitude']); 
      var marker = new google.maps.Marker({ 
       position: pos, 
       map: map, 
       zoom:14, 
       icon: gicons["blue"] 
      }); 
      latlngbounds.extend(pos); 
      var str = '<div class="google_popup"><span style="color:#00aeef; font-weight:bold; font-size: 14px; ">'+Obj['name']+'</span></b><div>'+Obj['address']+'</div><div>'+Obj['city']+', '+Obj['state']+' '+Obj['zip']+'</div><div> <a href="mailto:'+Obj['email']+'" title="'+Obj['email']+'">'+Obj['email']+'</a></div><div>'+Obj['phone']+'</div></div>'; 
      google.maps.event.addListener(marker, "click", function() { 
       map.panTo(pos); 
       map.setZoom(14); 
       info.setContent(str); 
       info.open(map, marker); 
       //openTrInfo($("#" + Obj['elemID'])[0], false); 
       var emid=Obj['elemID']; 
       merchant_deals(emid); 
      }); 

      google.maps.event.addListener(marker, "mouseover", function() { 
       marker.setIcon(gicons["grey"]); 
      // map.panTo(pos); 
       info.setContent(str); 
       info.open(map, marker); 
       var emid=Obj['elemID']; 

      }); 
      google.maps.event.addListener(marker, "mouseout", function() { 
       marker.setIcon(gicons["blue"]); 
       info.close(map, marker); 
      }); 
      gmarkers.push(marker); 
      return marker; 
     } 
+1

所有你需要做的,是刪除線15的16.你可以閱讀,地圖.panTo(POS); map.setZoom(14);平底鍋和縮放到標記的位置 –

+0

不工作...... – Karan

回答

0
var info = new google.maps.InfoWindow(); 
     var info = new google.maps.InfoWindow({ 

         disableAutoPan: true 
       });