Created
November 30, 2017 08:09
-
-
Save trixter5/6270fc399793d87a6f807d3a399e6846 to your computer and use it in GitHub Desktop.
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(init); // когда апи готово, инициализируемя карту | |
| var customMap; // объявим переменную для карты | |
| function init () { // функция инициализации | |
| customMap = new ymaps.Map("contactsMap", { // создадим карту выведем ее в див с id="customMap" | |
| center: [56.8585970678523,35.919971999999994], // центра карты | |
| behaviors: ['default', 'scrollZoom'], // скроллинг колесом | |
| zoom: 18, // масштаб карты | |
| controls: ["zoomControl", "fullscreenControl"] // элементы управления | |
| }); | |
| customPlacemark0 = new ymaps.Placemark([56.8585970678523,35.919971999999994], { // Создаем метку с координатами точки | |
| //balloonContent: '<h4> Заголовок метки</h4><p>Описание метки.</p><a class="customMapClose" onclick="customMap.balloon.close()">X</a>' // содержимое балуна в формате html, все стили в css | |
| }, { | |
| iconLayout: 'default#image', | |
| iconImageHref: 'images/map-icon.png', // иконка иконки | |
| iconImageSize: [168, 130], // размер иконки | |
| iconImageOffset: [-48, -146], // позиция иконки | |
| balloonContentSize: [270, 99], // размер нашего кастомного балуна в пикселях | |
| //balloonLayout: "default#imageWithContent", // указываем что содержимое балуна - стилизовано | |
| //balloonImageHref: 'img/baloon.jpg', // Картинка заднего фона балуна | |
| balloonImageOffset: [-65, -89], // смещание балуна, надо подогнать под стрелочку | |
| //balloonImageSize: [260, 89], // размер картинки-бэкграунда балуна | |
| balloonShadow: true | |
| }); | |
| // Добавляем метки на карту | |
| customMap.geoObjects.add(customPlacemark0); | |
| customMap.behaviors.disable('scrollZoom'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment