0

I wrote code at ArcGis JavaScript. There is a map on web page at full display with a fixed height (400px) When i scroll-down page and cursor misses in zone map then browser works for zooming map, not scroll page further. How to forbid?

1 Answer 1

2

If I understand correctly, the problem is that as you scroll down on the page, if the cursor enters the map region, the map zooms (rather than scrolling).

Which version of the ArcGIS JavaScript API are you using? In versions later than 2.7, the default action is scroll rather than zoom. This post explains how it works on a Mac:

The default behavior is pan, press the shift key to enter zoom mode.

Edit: You can disconnect the zoom from the mouse wheel. Try adding the following code to this sandbox sample:

map.on("load", function() {
  map.disableScrollWheelZoom();
});

I'm not sure whether it's possible to connect the scroll wheel to the pan function. This may be possible using DOM events. Since it would only work north/south it would be an unusual behaviour anyway...

3
  • That is surprising. I can't reproduce the scrolling instead of zooming. Take this sample: developers.arcgis.com/javascript/samples/widget_toggle whenever I move the mouse scroll wheel, the map zooms, and does not pan. May 27, 2014 at 6:47
  • @DevdattaTengshe sorry, I didn't realise you were both talking about the mouse wheel. Answer edited May 27, 2014 at 22:51
  • On a second reading of the question, I'm not sure if the OP is scrolling down using the mouse scroll wheel or the arrow keys. But your expanded answer handles both the cases, so it should satisfy the OP. May 28, 2014 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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