R
R
RushV2018-10-26 14:21:37
JavaScript
RushV, 2018-10-26 14:21:37

How to change the location of the Yandex map?

How to change the location of the map The default is to center the map itself and the label.
How can I make it be on the left for example?

ymaps.ready(init);

function init() {
    var myMap = new ymaps.Map('map', {
        center: [56.14737435930331,49.01713017790985],
        zoom: 17,
        controls: []
    }, {
        searchControlProvider: 'yandex#search'
    });
  
  myMap.behaviors.disable('scrollZoom');
  
  myMap.controls.add("zoomControl", {
        position: {top: 15, left: 15}
    });
  
          
    
    var placemark = new ymaps.Placemark(myMap.getCenter(), {
        // Зададим содержимое заголовка балуна.
        balloonContentHeader: 'НПП Раст-Т<br>' +
            '<span class="description">Системы безопасности</span>',
        // Зададим содержимое основной части балуна.
        balloonContentBody: '<img src="img/cinema.jpg" height="150" width="200"> <br/> ' +
            '<a href="tel:+7-123-456-78-90">+7 (123) 456-78-90</a><br/>' +
            '<b>Ближайшие сеансы</b> <br/> Сеансов нет.',
        // Зададим содержимое нижней части балуна.
        balloonContentFooter: 'Информация предоставлена:<br/>OOO "Рога и копыта"',
        // Зададим содержимое всплывающей подсказки.
        hintContent: 'Рога и копыта'
    });
  
    // Добавим метку на карту.
    myMap.geoObjects.add(placemark);
    // Откроем балун на метке.
    placemark.balloon.open();
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
gracer, 2018-10-26
@RushV

center: [56.14737435930331,49.01713017790985],
Here the coordinates of the center of the map are configured.
Here the coordinates of a point on the map are indicated.
Turn as you need, read the Yandex Maps api documentation.

F
freeExec, 2018-10-26
@freeExec

Take bounds from the map and move the center 30% from it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question