Skip to content

Instantly share code, notes, and snippets.

@kkd927
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkd927/7e8a51184f605bf2b972 to your computer and use it in GitHub Desktop.
Save kkd927/7e8a51184f605bf2b972 to your computer and use it in GitHub Desktop.
다음 지도 API v3 예제: 인포윈도우 올리기
<script type="text/javascript" src="http://apis.daum.net/maps/maps3.js?apikey=DAUM_MAPS_DEMO_APIKEY" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var map;
$ (function init() {
map = new daum.maps.Map(document.getElementById('map'), {
center: new daum.maps.LatLng(37.537123, 127.005523),
level: 2
});
var marker = new daum.maps.Marker({
position: map.getCenter()
});
marker.setMap(map);
var infowindow = new daum.maps.InfoWindow({
content: '<p style="margin:7px 22px 7px 12px;font:12px/1.5 sans-serif"><strong>안녕하세요~</strong><br/>다음커뮤니케이션입니다.</p>',
removable : true
});
# 마커 클릭 시 팝업 인포윈도우 띄우기
daum.maps.event.addListener(marker, "click", function() {
infowindow.open(map, marker);
});
# 맵에 인포윈도우만 띄우기
var infowindow_only = new daum.maps.InfoWindow({
position: new daum.maps.LatLng(37.5367434970359, 127.00491278024688),
content: '<p style="margin:7px 12px;font-size:12px">인포윈도우만 띄울 수도 있습니다.</p>'
});
infowindow_only.open(map);
})
</script>
<div id="map" style="width:600px;height:600px;"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment