私は座標属性を持つdivを持っています:
<div class="c" coordinates="32.100,-118.3232">
..
</div>
jqueryの助けを借りて座標を取得しています:
var coord = $(".c").attr("coordinates");
これをGoogleマップのjavascriptに入れる必要がある場合、これを何らかの方法で変換する必要がありますか?
var latlng = new google.maps.LatLng(coord );
addmarker(latlng)
function addmarker(latilongi) // function to add new marker when click on compare
{
var marker = new google.maps.Marker({
position: latilongi,
title: 'new marker',
draggable: true,
map: map
});
map.setCenter(marker.getPosition())
}
自分のページにデプロイしたときに、適切な場所に収まらないようです。
ありがとう