Answer the question
In order to leave comments, you need to log in
Yandex map settings on different screen extensions?
It is necessary that on the desktop there is one central point, and on the phone another. How will this be achieved? Just like changing other settings, for example, on the computer there is a "drag" setting, but on the phone it is disabled. Is there something like media?
ymaps.ready(init);
function init() {
var myMap = new ymaps.Map("map", {
center: [54.755553, 55.897349],
zoom: 12
});
myMap.controls.remove('geolocationControl').remove('searchControl').remove('routeButton').remove('rulerControl').remove('fullscreenControl').remove('typeSelector').remove('trafficControl');
myMap.behaviors.disable([
'scrollZoom',
'drag'
]);
var placemark = new ymaps.Placemark([54.752656, 56.002053], {}, {
iconLayout: 'default#image',
iconImageHref: 'img/maps.png',
iconImageSize: [48, 48],
iconImageOffset: [-24, -48]
});
myMap.geoObjects.add(placemark);
}
Answer the question
In order to leave comments, you need to log in
Have a nice day)
Yes, of course, such an opportunity exists, because. this is JS, you just need to bind the handler to the event
const APIReadyHandler = () => {
if (window.innerWidth <= 500) {
myMap.setCenter([59.465577, 30.900147]);
myMap.behaviors.enable('scrollZoom', 'drag')
}
}
ymaps.ready(function() {
APIReadyHandler();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question