Skip to content

Instantly share code, notes, and snippets.

@chikoski
Last active December 18, 2015 01:09
Show Gist options
  • Save chikoski/5702190 to your computer and use it in GitHub Desktop.
Save chikoski/5702190 to your computer and use it in GitHub Desktop.
@CHARSET "UTF-8";
#map{
width: 300px;
height: 300px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Map App</title>
<link rel="stylesheet" type="text/css" href="css/mapApp.css">
</head>
<body>
<section>
<section role="region">
<header>
<h1>Map App</h1>
</header>
</section>
<div id="map"></div>
</section>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="js/mapApp.js"></script>
</body>
</html>
// 地図が代入される変数
var map;
// 地図を初期化する関数
var initMap = function(){
// 緯度経度から地点を表すデータを作成
var latlng = new google.maps.LatLng(35.388276, 139.427348);
// マップの表示方法に関する設定をまとめたオブジェクトの作成
var opt = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//地図の表示
map = new google.maps.Map(document.getElementById('map'), opt);
// 表示中の地図を返す
return map;
};
var initApp = function(){
initMap();
};
window.onload = initApp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment