I have been testing OpenLayers for a while and I notice that the scrolling on OpenStreetMap layer does not make the map zoom in or out as much as I would like it to be. On most occasions, I am only able to zoom in or out by only one level at a time, regardless of the scroll clicks. However, when the base layer is switched to Google Maps, I am able to zoom in and out more with more scroll clicks. You can see the difference with this example.

At first, I thought this could be due to some inherent problem with OpenStreetMaps, but after testing its own map on the main site, there seem to be no problem with zooming through multiple levels with a mouse scroll. Am I missing something in the OpenLayers control setting to enable such responsive scrolling behaviour?

3 Answers 3


The documentation doesn't say much about this, but if you examine the script, there is a mousewheel interval option:

 * Property: interval
 * {Integer} In order to increase server performance, an interval (in 
 *     milliseconds) can be set to reduce the number of up/down events 
 *     called. If set, a new up/down event will not be set until the 
 *     interval has passed. 
 *     Defaults to 0, meaning no interval. 
interval: 0,

This value can be changed by setting the following when declaring map controls:

new OpenLayers.Control.Navigation(
 {mouseWheelOptions: {interval: 500}}

You can try overriding the createMap function and define your own scales. Something like below (just put your own values in the scales):

createMap: function(mapDiv) {
    var controls = [new OpenLayers.Control.Navigation()];
        options = {
            projection: new OpenLayers.Projection("EPSG:2039"),
            displayProjection: new OpenLayers.Projection("EPSG:2039"),
            units: "m",
            maxExtent: new OpenLayers.Bounds(-154106, 360012, 603185, 838233),
            scales: [13000, 7000, 5000, 4500, 3500, 1700, 1000, 500],
            controls: controls
  • I don't think this is a solution to the problem. Skipping zoom levels and making it more responsive are two different issues altogether. Nov 12, 2012 at 7:09

When instantiating the OpenLayers Navigation bar, you can define the mouse wheel options [1]. The mouse wheel options are defined at the MouseWheel handler [2]. Here I leave an example:

var ctrlNav = new OpenLayers.Control.Navigation({
    mouseWheelOptions : {
        interval: 10, //{Integer} In order to increase server performance, an interval (in milliseconds) can be set to reduce the number of up/down events called.
        maxDelta: 1, //{Integer} Maximum delta to collect before breaking from the current interval.
        delta: 1, //{Integer} When interval is set, delta collects the mousewheel z-deltas of the events that occur within the interval.
        cumulative:false, //{Boolean} When interval is set: true to collect all the mousewheel z-deltas, false to only record the delta direction (positive or negative)

[1] http://dev.openlayers.org/docs/files/OpenLayers/Control/Navigation-js.html#OpenLayers.Control.Navigation.mouseWheelOptions

[2] http://dev.openlayers.org/docs/files/OpenLayers/Handler/MouseWheel-js.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.