Skip to content

Instantly share code, notes, and snippets.

@progreccor
Created July 18, 2021 08:51
Show Gist options
  • Save progreccor/03bb2f4d5597de4eaa6d4cff31a1db9a to your computer and use it in GitHub Desktop.
Save progreccor/03bb2f4d5597de4eaa6d4cff31a1db9a to your computer and use it in GitHub Desktop.
карта сайта яндекса
<p class="uk-hidden@s uk-text-center uk-margin-top">Передвинуть карту можно двумя пальцами</p>
<div id="YMapsID" class="uk-img-preserve" style="width: 100%; height: 600px; padding: 0; margin: 0;"></div>
<script src="https://api-maps.yandex.ru/2.1/?lang=ru-RU&amp;coordorder=latlong" type="text/javascript"></script>
<script type="text/javascript">// <![CDATA[
var map;
ymaps.ready(function () {
var isMobile = window.matchMedia("only screen and (max-width: 760px)");
//Создание карты и задание свойств
map = new ymaps.Map("YMapsID", {
center: [59.91957123, 30.35279517],
zoom: 16,
maxZoom: 17,
minZoom: 10,
type: "yandex#map",
controls: ['routeButtonControl'],
behaviors: ["default"]
}
);
map.behaviors.disable('scrollZoom');
if(isMobile.matches) {
map.behaviors.disable('drag');
}
var iconImageHref = "images/kontakty/photo_2019-11-12_11-02-48.jpg";
var iconImageSize = [50, 50];
var iconImageOffset = [-50, -50];
var office = new ymaps.Placemark(
[59.91957123, 30.35279517], {
balloonContent: '<div style="width: 200px; text-align: left; padding: 5px;"><div style="color: black; font-size: 13px; text-align: left; padding: 15px;">Санкт-Петербург,<br /> Лиговский проспект, 111<br />8 (921)94-111-46</div></div>'
}, {
iconLayout: 'default#image',
iconImageHref: iconImageHref,
iconImageSize: iconImageSize,
iconImageOffset: iconImageOffset
},
{
draggable: false,
hideIconOnBalloonOpen: true
}
);
map.geoObjects.add(office);
office.balloon.open();
map.controls.add('zoomControl', {
size: 'auto'
});
});
// ]]></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment