Answer the question
In order to leave comments, you need to log in
Urgently! How to run 2 Yandex Maps on one page?
On the site apart-bukovel.londhor.com I am trying to use 2 Yandex cards.
The first one works, the second one doesn't.
If you change the cards in the code in places - again - the one that is the first in the code works.
It seems I connected everything correctly, but it does not work. Card IDs are unique.
var placing = new ymaps.Map("google_map", {
center: [48.353870, 24.426673],
zoom: 16,
controls: []
}),
home_point = new ymaps.Placemark([48.353870, 24.426673],{iconImageHref: 'img/pointer.png'}, {
iconLayout: 'default#image',
iconImageHref: 'img/pointer.png',
iconImageSize: [106, 90],
iconImageOffset: [-52, -45]
});
placing.geoObjects.add(home_point)
.add('zoomControl');
var contacts = new ymaps.Map("contacts_map", {
center: [49.845673, 24.029431],
zoom: 16,
controls: []
}),
contacts_point = new ymaps.Placemark([49.845673, 24.029431],{iconImageHref: 'img/pointer.png'}, {
iconLayout: 'default#image',
iconImageHref: 'img/pointer.png',
iconImageSize: [106, 90],
iconImageOffset: [-52, -45]
});
contacts.geoObjects.add(contacts_point)
.add('zoomControl');
Answer the question
In order to leave comments, you need to log in
You doing
but zoomControl is never a geoObject, it's a control ( see the official documentation ). At this point, an Uncaught TypeError: child.getParent is not a function error occurs , which is immediately visible in the console. The above documentation has an example of where to add the zoomControl.
PS: You should not produce the same questions - this will not speed up your response. A more efficient approach would be to immediately point out the error that occurs and point to the line in which it occurs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question