Created
December 14, 2016 15:42
-
-
Save Yelakelly/c528a7918789c4ae4279e15a862a263a to your computer and use it in GitHub Desktop.
YandexMap snippet - route, offset, drag disabled on mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ymaps.ready(function () { | |
var pointA = "Смоленская метро", | |
pointB = "ул. Арбат д.51 , стр.1", | |
/** | |
* Создаем мультимаршрут. | |
* @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/multiRouter.MultiRoute.xml | |
*/ | |
multiRoute = new ymaps.multiRouter.MultiRoute({ | |
referencePoints: [ | |
pointA, | |
pointB | |
], | |
params: { | |
//Тип маршрутизации - пешеходная маршрутизация. | |
routingMode: 'pedestrian' | |
} | |
}); | |
var myMap = new ymaps.Map('map', { | |
center: [55.747395, 37.584142], | |
zoom: 17, | |
controls: ['zoomControl'] | |
}); | |
myMap.geoObjects.add(multiRoute); | |
var position = myMap.getGlobalPixelCenter(); | |
myMap.setGlobalPixelCenter([ position[0] - 100, position[1] ]); | |
if($(window).width() < 800){ | |
myMap.behaviors.disable('drag'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment