inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

코로나맵 개발자와 함께하는 지도서비스 만들기 1

여러개의 마커 생성하기

별다른 오류창 없이 마커가 송출되지 않습니다

229

알부동산TV

작성한 질문수 1

0

index.ejs
var data = [
{
title: "서울",
content: "서울 남산",
date: "2021-07-02",
lat: 37.515145,
lng: 127.035393,
},
{
title: "서울2",
content: "서울 용산",
date: "2021-07-20",
lat: 37.515000,
lng: 127.016676,
}
]
index.ejs
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<title>myfirstmap</title>
<link rel="stylesheet" href="/stylesheets/style.css" />
<script type="text/javascript"
src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=xme01nth90"></script>
</head>

<body>
<div id="navber">myfirstmap</div>
<div id="infobox">
<div id="infotitle">현재날짜</div>
<div id="infocontent">today</div>
</div>

<div id="map" style="width:100%;height:100vh;"></div>
<script type="text/javascript" src="/myfirstmap/public/data/data.js"></script>
<script>
var mapOptions = {
center: new naver.maps.LatLng(37.3595704, 127.105399),
zoom: 10
};
var map = new naver.maps.Map('map', mapOptions);

for (var i in data){
var target = data[i];
var latlng = new naver.map.Latlng(target.lat, target.lng);
Marker = new naver.maps.Marker({
map: map,
position: latlng,
icon: {
content: "<div class='Marker'></div>",
},
});
}

</script>
</body>
</html>
style css
body {
padding: 0px !important ;
margin: 0px !important ;
}

#navber {
height: 50px;
width: 100%;
background: #262626;
color: white;
font-weight: bolder;
font-size: 25px;
display: flex;
justify-content: center;
align-items: center;
}

#infobox {
position : absolute;
top: 100px;
z-index: 10000;
background: white;
left: 20px;
padding: 15px;
border: 1px solid rgba(0, 0, 0, 0.2);
}

#infotitle {
font-size: 15px;
font-weight: bolder;
}

.Marker {
border: 1px solid black;
background: green;
opacity: 0.8;
width: 24px;
height: 24px;
border-radius: 50%;
}

웹앱 nodejs express vscode

답변 0

map API

0

50

1

nodejs 터미널 인식

0

53

1

kakao is not defined 오류

0

436

1

nodemon ./bin/www 입력 시 오류

0

174

1

호스팅 및 도메인 관련

0

168

1

마커이미지가 깨집니다

0

150

2

nodemon설치와 express-generator 오류

0

225

1

코드를 다운받을수 있나요?

0

214

1

SUDO를 계속 입력하지 않는 방법을 알 수 있을까요?

0

618

1

var로 선언하는 이유

0

375

1

Places 코드가 안돼요.

0

358

0

애니메이션 관련 질문

0

278

1

(index):121 Uncaught ReferenceError: kakao is not defined at (index):121:10

0

624

0

히트맵 구성

0

247

0

이벤트리스너 추가부분 질문..

0

311

2

for문 돌릴때 ii 에 대해서 궁금합니다.

1

398

1

express 설정

0

260

0

이름공간 문법?

0

281

0

마커가 안뜹니다

1

326

2

nodemon 설치 에러

0

419

1

AI NAVER API 관련 질문

1

381

2

궁금한게 있어요 link로 연결할때 href에 public 경로를 빼야만 적용되는 이유는 뭔가요??

1

233

0

node와 ncm 의 버전 확인이 안됩니다ㅠㅠ

0

431

1

저장후엔 localhost가 열리지 않네요ㅠ

0

306

0