Created
July 27, 2021 12:08
-
-
Save OlegShchavelev/02ef712c3b32d709d18bcf07a8a8c48a to your computer and use it in GitHub Desktop.
Яндекс карта в табах Bootstrap 4
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
if (document.querySelector('.dsmc-yandex-map-layout')) { | |
document.querySelectorAll('.dsmc-yandex-map-layout').forEach(e => { | |
const coords = e.dataset; | |
ymaps.ready(init); | |
var myMap, | |
myPlacemark; | |
function init() { | |
var myMap = new ymaps.Map(e, { | |
center: [coords['coordsX'], coords['coordsY']], | |
zoom: 13, | |
controls: [] | |
}); | |
var myPlacemark = new ymaps.Placemark([coords['coordsX'], coords['coordsY']], { | |
hintContent: 'Москва!', | |
balloonContentHeader: 'Шоу-рум и офис продаж ОКЛИ', | |
balloonContent: 'улица Рентгена, дом 23', | |
balloonContentFooter: '<p class="mt-2 mb-1 text-sm text-dark">Телефоны: <b>+7 (812) 232-12-85 +7 (812) 232-12-85</b></p><p class="text-sm"><a href="malito:okli-parket@mail.ru">okli-parket@mail.ru</a></p>' | |
}); | |
myMap.geoObjects.add(myPlacemark); | |
console.log(myMap.container); | |
$('a[data-toggle="tab"]').on('shown.bs.tab', function () { | |
console.log('seoTab переключился'); | |
console.log(myMap.container); | |
myMap.container.fitToViewport(); | |
}); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment