Viewing an older version of mapbox.js. Check out v1.4.0 for the latest.

Zoom bar

Add a draggable bar for setting map zoom
0
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Zoom bar</title>
  <script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
  <link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
  <style>
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
<div id='z'>
<div id='zoom-bar' class='dragdealer'>
    <div id='handle' class="handle">0</div>
</div>
</div>
<div id='map'>
</div>
<script src='https://api.tiles.mapbox.com/mapbox.js/v0.6.5/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v0.6.5/mapbox.css' rel='stylesheet' />

<!-- if you plan to use this example, download drag dealer from
https://code.google.com/p/dragdealer/ instead of hotlinking it like this -->
<script src='https://dragdealer.googlecode.com/svn/tags/0.9.5/dragdealer.js'></script>
<style>
#z {
  top:10px;
  left:80px;
  position:absolute;
  z-index:999;
  }
#zoom-bar {
  width:200px;
  position:relative;
  height:30px;
  background:#FFF;
  border:1px solid #BBB;
  -webkit-border-radius:3px;
          border-radius:3px;
  }
.dragdealer .handle {
  position:absolute;
  cursor:pointer;
  width:30px;
  height:30px;
  background:#222;
  color:#fff;
  font-weight:bold;
  line-height:30px;
  text-align:center;
  }
</style>
<script>
mapbox.auto('map', 'examples.map-vyofok3q', function(map) {
    var zooms = 17;
    var handle = document.getElementById('handle');

    // Configure Dragdealer to update the map zoom
    var zoom_bar = new Dragdealer('zoom-bar', {
        steps: zooms,
        snap: true,
        callback: function(x, y) {
            var z = x * (zooms - 1);
            map.zoom(z, true);
            handle.innerHTML = z;
        }
    });

    // Round zoom so that numbers in the bar look presentable.
    map.addCallback('zoomed', function() {
        var z = Math.round(map.zoom());
        zoom_bar.setValue(z / 16);
        handle.innerHTML = z;
    });

    // Set the initial map position
    map.zoom(9).center({ lat: 34.660322, lon: 132.506103 });
});
</script>
</body>
</html>
The code and documentation to mapbox.js is hosted on GitHub where you can contribute changes and improvements.