Answer the question
In order to leave comments, you need to log in
How to add a div on Yandex Maps next to the label?
I'm not very familiar with JS, so I need help. I want to implement this
.
Using the Chrome designer, I moved this div shown as a cloud in the screenshot inside the ymaps-point-overlay tag. How to add this div via code? I use the version of Yandex Maps 1.0. I add a map via html. The cloud shown on the screenshot is not a balloon used in YaK, but just a picture added to a div.
<div class="map">
<script type="text/javascript" charset="utf-8" src="//api-maps.yandex.ru/services/constructor/1.0/js/?sid=kVbhcu1s3Dkltv6kZpiPcnI8Iooz42jb&width=100%&height=500"></script>
<div class="addressBox"></div>
</div>
Answer the question
In order to leave comments, you need to log in
In general, the problem was solved with a small hack. Namely, I did not find the onLoad event in version 1.0 of maps, so I used the setTimeout method after the map loaded to add a div.
$(document).ready(function() {
function addDiv() {
var itemClass = "addressBox";
$(".ymaps-point-overlay").append('<div class="' + itemClass + '"></div>');
}
setTimeout(addDiv, 5000);
});
Perhaps the question is not how to display this div, but how to position it?
I would use absolute positioning by calculating and setting the coordinates with JS:
api.jquery.com/css
api.jquery.com/position
htmlbook.ru/css/position
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question