You are viewing an older version of MapQuest.js. Check out the latest version.
A single button control that toggles on and off traffic layers. The trafficLayer, and incidentsLayer, and marketsLayer are all on by default but can be disabled with options. The position, title, and className of the control are customizable.
L.mapquest.key = 'KEY';
var map = L.mapquest.map('map', {
center: [34.0522, -118.2437],
layers: [tileLayer],
zoom: 12
});
map.addControl(L.mapquest.trafficControl());
An object containing any of the following key value options: position, flow, incidents, markets, title, and className.
The position of the control (one of the map corners).
Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'.
A boolean on whether to render traffic flow/congestion layer on control click.
A boolean on whether to render traffic incidents layer on control click.
A boolean on whether to render traffic markets layer on control click.
Text for the browser tooltip that appear on control hover.
A custom CSS class name to assign to the control.
{
position: 'topright',
flow: true,
incidents: true,
markets: true,
title: 'Traffic',
className: ''
}
An L.Control object that can be added to a map with the addControl() function.