我需要有关Google标记的帮助。我有CSV文件,其中包含地址信息,公司名称,公司所有者等。我在Google地图上使用CSV文件中的地址显示标记。现在,我想在单击该特定标记时显示该CSV文件中的所有信息。 这是代码和一些图片供您使用,再次感谢
ss.map_get_geocode = function(){
$(".map_get_geocode")
.off()
.on("click", function(e){
e.preventDefault();
$(".list_company .address").each(function(){
var dis = $(this).attr("id");
var d_lat = "";
var d_lng = "";
var relationship = $(this).attr("data-relationship");
var relationship_marker = "";
if(relationship == "supplier"){
relationship_marker = "http://maps.google.com/mapfiles/ms/icons/blue-dot.png";
}else if(relationship == "competition"){
relationship_marker = "http://maps.google.com/mapfiles/ms/icons/red-dot.png";
}else{
relationship_marker = "http://maps.google.com/mapfiles/ms/icons/yellow-dot.png";
}
$.ajax({url: "https://maps.googleapis.com/maps/api/geocode/json?address="+$(this).attr("data-address")+", Srbija&key=AIzaSyAapolAYHULzJzMlNNiLkuwg2riTKiecHA"})
.done(function(result){
if(result.results[0].geometry.location.lng != undefined){
d_lat = result.results[0].geometry.location.lat;
d_lng = result.results[0].geometry.location.lng;
console.log(d_lng);
$("#"+dis).attr("data-lat", d_lat);
$("#"+dis).attr("data-lng", d_lng);
var myLatlng = new google.maps.LatLng(d_lat,d_lng);
var marker = new google.maps.Marker({
position: myLatlng,
title: $(this).attr("data-address"),
animation: google.maps.Animation.DROP,
icon: { url: relationship_marker}
});
marker.setMap(map);
$(".columns").empty();
$(".sticky_header div").each(function(){
$(".columns").append("<li class=\""+$(this).attr("class")+"\"><a class=\"nav_selected\" href=\"#\">"+$(this).attr("class")+"</a></li>");
});
$(".columns li").on("click", function(){
$(".list_company ."+$(this).attr("class")).slideToggle(50);
$(".sticky_header ."+$(this).attr("class")).slideToggle(50);
$(this).find("a").toggleClass("nav_selected");
ss.label_ironing();
});
}
});
});
});
};