Answer the question
In order to leave comments, you need to log in
Yandex map API how to shift the center of the map by px?
Greetings, please tell me how to move the center of the map along with the marker to the left by 100px?
Tried through
var positions = myMap.getGlobalPixelCenter();
myMap.setGlobalPixelCenter([ positions[0] - 100, positions[1] ]);
if ($('.map').length) {
ymaps.ready(function () {
var myMap = new ymaps.Map('map', {
center: [55.------, 37.------],
zoom: 17
}, {
searchControl: 'yandex#search'
});
var positions = myMap.getGlobalPixelCenter();
myMap.setGlobalPixelCenter([ positions[0] - 100, positions[1] ]);
myPlacemark = new ymaps.Placemark(myMap.getCenter(), {
balloonContent: 'ул. Примерная д. 13А'
}, {
iconLayout: 'default#image',
iconImageHref: '../media/bg/local2.svg',
iconImageSize: [266, 81],
iconImageOffset: [-40, -40]
});
myMap.geoObjects
.add(myPlacemark)
myMap.controls.remove('searchControl')
myMap.behaviors.disable('scrollZoom')
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question