Panning

Panning can be accomplished several ways. You can grab and pan the map with the mouse, use a control that has panning capabilities such as the MQA.LargeZoom, or you can do it programmatically.


Using a Control

By adding the MQA.LargeZoom to your map, you can use it to pan the map North, South, East or West:

MQA.withModule('largezoom', function() {
	
  map.addControl(
    new MQA.LargeZoom(), 
    new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT, new MQA.Size(5,5))
  );

});

The above code adds a MQA.LargeZoom to the map. In the upper portion of the control, you will see arrows you can use to pan the map.

Show me the code

Play with the code


Programmatically

You can also programmatically pan the map the map with the following calls where map is a reference to a MQA.TileMap object.

	
	map.panNorth();
	map.panSouth();
	map.panEast();
	map.panWest();
	map.panNorthEast();
	map.panNorthWest();
	map.panSouthEast();
	map.panSouthWest();
	

Below is an example using an anchor tag to call the map panning functions.

North | South | East | West | Pan North East | Pan North West | Pan South East | Pan South West

Show me the code

Play with the code



Next Section: Zooming



  © MapQuest, Inc. All rights reserved.    Privacy Policy | Terms of Use