--- layout: api title: "v1.6.0 API: L.mapbox.gridControl(layer, options)" categories: api version: v1.6.0 permalink: /api/v1.6.0/l-mapbox-gridcontrol --- {% raw %}
Interaction is what we call interactive parts of maps that are created with the powerful tooltips & regions system in TileMill. Under the hood, it's powered by the open UTFGrid specification.
Options | Value | Description |
---|---|---|
layer | L.mapbox.gridLayer | The first argument must be a layer created with L.mapbox.gridLayer() |
options | object | Valid options are:
|
Example:
var map = L.mapbox.map('map').setView([38, -77], 5);
var gridLayer = L.mapbox.gridLayer('examples.map-8ced9urs');
map.addLayer(L.mapbox.tileLayer('examples.map-8ced9urs'));
map.addLayer(gridLayer);
map.addControl(L.mapbox.gridControl(gridLayer));
Returns: a L.mapbox.gridControl
object.
If a tooltip is currently shown by the gridControl, hide and close it.
Returns: the L.mapbox.gridControl
object.
Change the Mustache template used to transform the UTFGrid data in the map's interactivity into HTML for display.
Options | Value | Description |
---|---|---|
template | string | A string of Mustache template code for popups. |
Returns: the L.mapbox.gridControl
object.