Skip to content

Instantly share code, notes, and snippets.

@yhahn
Created January 23, 2013 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yhahn/4601671 to your computer and use it in GitHub Desktop.
Save yhahn/4601671 to your computer and use it in GitHub Desktop.
Mousewheel offset + fixed position
<!DOCTYPE html>
<html>
<head>
<script src='https://raw.github.com/modestmaps/modestmaps-js/master/modestmaps.min.js'></script>
<style>
body { margin:0; padding:0; height:2000px; }
#map { position:fixed !important; top:0; width:500px; height:300px; }
</style>
</head>
<body>
<div id='map'></div>
<script>
var template = 'http://c.tiles.mapbox.com/v3/examples.map-szwdot65/{Z}/{X}/{Y}.png';
var provider = new MM.TemplatedLayer(template);
var map = new MM.Map('map', provider);
map.setCenterZoom({ lat: 51.55, lon: 0.1 }, 5);
window.onload = function() { window.scrollTo(0,1000); };
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment