다음맵 api 마커 + 말풍선

Open API/Daum|2016. 10. 31. 09:12
반응형



다음맵 API를 이용한 기본 마커 + 말풍선 샘플 코드입니다.


<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width, target-densityDpi=device-dpi"> <title>용산전쟁기념관</title> <style type="text/css"> html, body, #map {margin: 0; padding: 0; width: 100%; height: 100%} </style> <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"> var map; function init() { map = new daum.maps.Map(document.getElementById('map'), { center: new daum.maps.LatLng(37.53592870797618, 126.97726376303085) });    var icon = new daum.maps.MarkerImage( 'http://maps.google.com/mapfiles/kml/pal3/icon46.png', new daum.maps.Size(20, 20), new daum.maps.Point(20, 20) ); var marker = new daum.maps.Marker({ position: new daum.maps.LatLng(37.5367, 126.9772), image : icon }); marker.setMap(map);    var infowindow = new daum.maps.InfoWindow({ content: '<a href="http://www.warmemo.co.kr" target="_blank" style="margin:1em;line-height:2;text-decoration:none">장소 : 용산전쟁기념관 기획전시실   <BR>     프로그램명: 코코몽 녹색놀이터 <br>     기간 : 2012.12.01-2012.12.31<br>     예약현황 : 80개 단체 5000명(현재)</a>' });   daum.maps.event.addListener(marker, "click", function() { infowindow.open(map, marker); });   daum.maps.event.addListener(map, "click", function() { infowindow.close(); });     var marker1 = new daum.maps.Marker({ position: new daum.maps.LatLng(37.5245, 126.9805), image : icon });   marker1.setMap(map); var infowindow1 = new daum.maps.InfoWindow({ content: '<a href="http://www.museum.go.kr" target="_blank" style="margin:1em;line-height:2;text-decoration:none">장소 : 국립중앙 박물관   <BR>     프로그램명: 2013 웨딩페어 <BR>     기간 : 2012.12.01-2012.12.31<BR>     예약현황 : 2개 단체 20000명(현재)</a>' });   daum.maps.event.addListener(marker1, "click", function() { infowindow1.open(map, marker1); });   daum.maps.event.addListener(map, "click", function() { infowindow1.close(); }); } </script> </head> <body onload="init()"> <div id="map"></div>    </body> </html>


댓글()