create map in javascript

This commit is contained in:
Nils Schneider 2015-03-23 13:25:52 +01:00
parent f54d430df3
commit 7a404926b2
2 changed files with 7 additions and 5 deletions

View file

@ -161,7 +161,7 @@
box-sizing: border-box; box-sizing: border-box;
} }
#sidebardata, #map { #sidebardata, .map {
height: 100vh; height: 100vh;
} }
@ -258,7 +258,7 @@
display: none; display: none;
} }
#map { .map {
height: 60vh; height: 60vh;
} }
@ -290,8 +290,6 @@
<script src="history.js"></script> <script src="history.js"></script>
</head> </head>
<body> <body>
<div id="map">
</div>
<div id="sidebar"> <div id="sidebar">
<button id="sidebarhandle"> <button id="sidebarhandle">
</button> </button>

View file

@ -34,7 +34,11 @@ function main() {
zoomControl: false zoomControl: false
} }
var map = L.map(document.getElementById("map"), options) var mapDiv = document.createElement("div")
mapDiv.classList.add("map")
document.body.insertBefore(mapDiv, document.body.firstChild)
var map = L.map(mapDiv, options)
var sh = document.getElementById("sidebarhandle") var sh = document.getElementById("sidebarhandle")
sh.onclick = function () { sh.onclick = function () {