Last active
August 1, 2017 19:28
-
-
Save IgorGavrilenko/ce3aba121e16c1dc9b4ecedbcfc0832f to your computer and use it in GitHub Desktop.
ymaps v.2.1 api
This file contains 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
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script> | |
<script> | |
ymaps.ready(function() { | |
var myMap = new ymaps.Map('mapId', { | |
center: [..., ...], | |
zoom: 16, | |
controls: ['zoomControl'] | |
}), | |
myPlacemark = new ymaps.Placemark(myMap.getCenter(), { | |
balloonContent: 'text' | |
hintContent: "text" | |
}, { | |
iconLayout: 'default#image', | |
iconImageHref: '/images/icon.png', | |
iconImageSize: [40, 42], | |
iconImageOffset: [-3, -42] | |
}); | |
myMap.behaviors.disable('scrollZoom'); | |
myMap.geoObjects.add(myPlacemark); | |
}); | |
</script> | |
// ymap | |
ymaps.ready(function() { | |
var myMap = new ymaps.Map('map', { | |
center: [57.15221807, 65.53199200], | |
zoom: 16, | |
controls: ['zoomControl'] | |
}), | |
myPlacemark = new ymaps.Placemark(myMap.getCenter(), { | |
balloonContent: '<div class="map-balloon"><img class="map-balloon__img" src="img/logo.png" alt="" title=""><br><br><address><span class="map-balloon__addr">г. Тюмень, ул. Герцена, 64, 9 этаж оф. 903</span><br><span class="map-balloon__phone">8 905 820-20-73</span></address></div>' | |
}); | |
myMap.behaviors.disable('scrollZoom'); | |
myMap.geoObjects.add(myPlacemark); | |
if (isMobile.any()) { | |
myMap.behaviors.disable('drag'); | |
} | |
myPlacemark.balloon.open(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment