V
V
Vladimir Sorokin2015-06-03 15:19:02
HTML
Vladimir Sorokin, 2015-06-03 15:19:02

How to scroll on the map?

Hello, dear Toaster users! There is a site www.silkwaylog.com , at the bottom is a Yandex map.
You need to make it so that you can scroll it, not the site. How to implement it? Google or Yandex Maps - it doesn't matter.
And the second way. In order to scroll the site, you can click on the map and so that it starts scrolling, again clicking on another place, the site will scroll again.
I'm a noob in these matters, so please explain more clearly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valentin Dubrovsky, 2015-06-04
@fwlt

We do this during initialization:

var myMap = new ymaps.Map("map", {
            center: [59.93, 30.31],
            zoom: 10,
            behaviors: ["scrollZoom"]
        }
    );
myMap.behaviors.disable("scrollZoom");

This is when clicking on a div with a map:
Should work, but did not check.

R
Roman, 2015-06-03
@paradoxo

jQuery

$('#map_canvas').addClass('scrolloff');  
    $('#canvas').on('click', function () {
        $('#map_canvas').removeClass('scrolloff'); 
    });
    $("#map_canvas").mouseleave(function () {
        $('#map_canvas').addClass('scrolloff');
    });

css
.scrolloff{
  pointer-events: none;
}

'#map_canvas - the map itself
'#canvas - the parent container

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question