Google Maps API v3 will not disable the scroll wheel after loading a map

I implement google maps on a website and everything works fine, except that I cannot turn off the scroll wheel after loading maps. If I set the parameter before the map loads in scrollwheel: false, then the scroll wheel will be disabled, but if I try to do it later (I have a checkbox that enables / disables the scroll wheel).

Here are my google map options when loading the page:

var myOptions = {
            zoom: 15,
            center: currentPosition,
            draggable: true,
            scrollwheel: true,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

map = new google.maps.Map (document.getElementById ("map_canvas"), myOptions);

and then after the click event has a trigger in this checkbox, I have the following code to disable scrollwheel. funny enough, draggable = false works and does not allow me to drag and drop the map.

var checked = $('#chkPin').is(':checked');
        log("map active: " + checked);
        if (checked) {
            map.scrollwheel = false;
            map.draggable = false;
            map.zoomControl = false;
        } else {
            map.scrollwheel = true;
            map.draggable = true;
            map.zoomControl = true;
        }
+5
1

API . . , :

/:

map.setOptions({'scrollwheel': false});

/ MVCObject:

map.set('scrollwheel', false);
var isScrollWheelEnabled = map.get('scrollwheel');

, .

+25

All Articles