infobox를 사용하여 팝업을 표시하려고하지만 Infobox가 Map 용으로 열리지 않습니다. Gmaps.js 스크립트를 사용 중이며,지도가 내용을 완벽하게로드하지만 infobox에만 문제가 있습니다. 여기 내 코드입니다 :infobox 및 Gmaps.js를 사용하여 Google지도에 팝업을 표시하려고하지만 마커 클릭시 창이 열리지 않습니까?
map = new GMaps({
div: '#gmap_geocoding',
lat: "20.5937",
lng: "78.9629",
zoom:5
});
var icon = {
url: "/img/marker/location-pointer.png", // url
scaledSize: new google.maps.Size(40, 40), // scaled size
origin: new google.maps.Point(0,0), // origin
anchor: new google.maps.Point(0, 0) // anchor
};
var infoBox;
var boxOptions = {
disableAutoPan: true,
alignBottom: true,
closeBoxURL: "",
maxWidth: 0, // no max
pixelOffset: new google.maps.Size(-140, -12),
infoBoxClearance: new google.maps.Size(1, 1)
};
infoBox = new InfoBox(boxOptions);
$results = $('#search-results').find('div.MapMarker');
$.each($results, function(key,value){
var lat = $(value).data('lat');
var lng = $(value).data('lng');
var name = $(value).data('name');
var sport = $(value).data('sport');
var image = $(value).data('image');
var contentString =
"<div class='infoWindow text-center'><h4><a href='{{ url('/activity/') }}/{{ $vendor->vendor_slug }}/{{ $vendor->activity_slug }}'>"+ name +"</a></h4><img src='"+ image +" 'class='img-responsive' style='width:220px; height:160px;'>"+
"<h5><strong>Sports:</strong> "+ sport + "</h5></div>";
var marker = map.addMarker({
lat:lat,
lng:lng,
icon: icon,
animation: google.maps.Animation.DROP,
title: name,
infoBox:{
content:contentString
}
});
});
당신은 인포 박스 외부 라이브러리 포함 할 필요가 (당신이 그 일을 할 수있다, 그러나 그것은 귀하의 질문에서 명확하지 않다)
A [mcve] 그 demonstrat을 제공하십시오 귀하의 문제. InfoBox 외부 라이브러리를 포함하고 있습니까? (게시 된 코드로 얻는 첫 번째 오류는 : '잡히지 않은 ReferenceError : 인포 박스가 정의되지 않았습니다.') – geocodezip