Disable Zoom in Scroll in jquery.gmap3

Asked 1 years ago, Updated 1 years ago, 70 views

I used googlemap3 to embed the map in the page.
(This map has its own marker.)

I would like to set the wheel scroll function to false, but I cannot implement it with the code below.
The map has been successfully displayed, but the option does not appear to work.

$('#gmap').gmap3({
    address: 'Shibuya Ward, Tokyo',
    latitude: ☓ ..☓☓ ,,
    longitude: ☓☓ .. ☓☓☓☓☓ ,☓,
    zoom:15,
    scrollwheel: false, // This is not reflected
    navigationControl: false,
    mapTypeControl: false,
    scaleControl: false,
    markers:
          {
            latitude: ☓ .. ☓☓☓☓☓ ,☓,
            longitude: ☓☓ .. ☓☓☓☓☓ ,☓,
            title: 'Dummy',
            icon: "Path to Image",
            openInfo —true
          }
     ]
});

javascript jquery api google-maps

2022-09-30 19:11

1 Answers

https://github.com/bumberboom/jquery.gmap3

This library does not seem to assume the use of the scrollwheel option, so you must rewrite jquery.gmap3.js.

From line 35

function addMap($self,mpOpt){
    varopt={
        scrollwheel —mpOpt.scrollwheel, /*here*/
        zoom —mpOpt.zoom,
        center: new google.maps.LatLng (mpOpt.latitude, mpOpt.longitude),
        mapTypeId:mpOpt.mapTypeId,
        navigationControl:mpOpt.navigationControl,
        mapTypeControl:mpOpt.mapTypeControl,
        scaleControl:mpOpt.scaleControl
    };

From line 146

$.fn[name_space].defaults={
        address: '' ,
        latitude: 0,
        longitude: 0,
        scrollwheel —true, /*here*/
        zoom —10,
        navigationControl: true,
        mapTypeControl: true,
        scaleControl: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        markers —[ ]
  };

By the way, there is another library with the same name, which seems to support scrollwheel from the beginning, so you may want to try it instead.

http://gmap3.net/en/


2022-09-30 19:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.