Last active
September 6, 2019 09:31
-
-
Save tristen/2520003 to your computer and use it in GitHub Desktop.
Basic Controls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map; | |
var initMap = function() { | |
var template = 'http://{S}tile.openstreetmap.org/{Z}/{X}/{Y}.png'; | |
var subdomains = ['', 'a.', 'b.', 'c.']; | |
var provider = new MM.TemplatedLayer(template, subdomains); | |
map = new MM.Map('map', provider, null, [ | |
new MM.MouseWheelHandler(null, true) | |
]); | |
map.setCenterZoom(new MM.Location(37.811530, -122.2666097), 14); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Modest Maps JS Demo | Basic Controls</title> | |
<link rel='stylesheet' href='style.css'> | |
</head> | |
<body onload='initMap()'> | |
<div id='controls'> | |
<ul> | |
<li><a href='javascript:map.zoomIn()'>zoom in</a></li> | |
<li><a href='javascript:map.zoomOut()'>zoom out</a></li> | |
<li><a href='javascript:map.panLeft()'>pan left</a></li> | |
<li><a href='javascript:map.panRight()'>pan right</a></li> | |
<li><a href='javascript:map.panDown()'>pan down</a></li> | |
<li><a href='javascript:map.panUp()'>pan up</a></li> | |
</ul> | |
</div> | |
<div id='map' /> | |
<script src='https://rawgithub.com/stamen/modestmaps-js/master/modestmaps.min.js'></script> | |
<script src='app.js'></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font: 13px/22px 'Helvetica Neue', Helvetica, sans; | |
margin: 0; | |
padding: 0; | |
} | |
a { | |
text-decoration: none; | |
color: #1a73c7; | |
font-weight: bold; | |
display: block; | |
padding: 0 5px 2px; | |
} | |
a:hover { | |
background-color: #1a73c7; | |
color: #fff; | |
} | |
ul { | |
margin: 0; | |
padding: 0; | |
list-style: none; | |
} | |
#controls { | |
background: #fff; | |
border: 1px solid #666; | |
padding: 5px; | |
z-index: 1000; | |
position: absolute; | |
top: 10px; left: 10px; | |
width: 98px; | |
box-shadow: 0 1px 8px rgba(0,0,0,0.3); | |
-moz-box-shadow: 0 1px 8px rgba(0,0,0,0.3); | |
} | |
#map { | |
position: absolute; | |
top: 0; left: 0; | |
width: 100%; | |
height: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment