Answer the question
In order to leave comments, you need to log in
How to embed the script on the page?
I'm trying to change yandex cards.
There is a mapInit() function; , which simply initializes the map when the document is ready.
Next, here is the code:
function createMapLang() {
let lang = localStorage.getItem('lang');
var newMap = `<script data-change='true' src="https://api-maps.yandex.ru/2.1/?apikey=f6857b56-4852-45e5-8221-f84bb63b1169&lang=${lang}"></script>`
$('body').append(newMap);
mapInit();
}
createMapLang();
$('.lang-list__link').each(function() {
$(this).click(function() {
let lang = $(this).attr('data-lang');
localStorage.setItem('lang', lang);
window.location.reload();
})
})
ReferenceError: ymaps is not defined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question