0
내 GMap에서 드롭 다운 목록을 사용하여 필요한 영역을 선택했습니다. 그것은 Firefox에서만 작동합니다. 다른 브라우저에서는 아무 것도하지 않는 영역을 선택할 때만 작동합니다.드롭 다운은 크롬, IE에서 작동하지 않으며 Firefox에서만 작동합니다.
이 $.getJSON("sample2.php", {}, function(data){
$.each(data.places2, function(i, item){
// $("#markers1").append('<li><a href="#" rel="' + i + '">' + item.title2 + '</a></li>');
$("#markers").append('<option value="' + i+ '">' + item.title2 +'</option>');
latlngbounds2.extend(new google.maps.LatLng(item.lat2, item.lng2));
map.setCenter(latlngbounds2.getCenter(), map.fitBounds(latlngbounds2));
var marker2 = new google.maps.Marker({
position: new google.maps.LatLng(item.lat2, item.lng2),
title: item.title2
// map: map
});
arrMarkers2[i] = marker2;
var infowindow2 = new google.maps.InfoWindow({
content: "<h3>"+ item.title2 +"</h3>" +"<p>"
});
arrInfoWindows2[i] = infowindow2;
});
});
}
$(function (){
mapInit();
// $('#markers option').click(function() {
$("#markers option").live("click", function(){
var i = $(this).attr("value");
// Эта строка кода, закрывает все открытые балуны, для открытия выбранного
for(x=0; x < arrInfoWindows2.length; x++){ arrInfoWindows2[x].close(); }
//arrInfoWindows2[i].open(map, arrMarkers2[i]);
map.setZoom(12);
map.setCenter(arrMarkers2[i].getPosition());
// alert(arrMarkers2[i]);
console.info(arrMarkers2[i]['title']);
});
});
이것은 HTML 코드 :
<div name="cont" id="container" >
<select id="markers">
<option>Select Region</option>
</select>
</div>
아무도 도와 드릴까요 여기 내 코드는?
고맙습니다. 그것은 작동합니다! – Sam