M
M
makcimusprime2018-02-14 02:08:36
JavaScript
makcimusprime, 2018-02-14 02:08:36

Is it possible to connect 2 Yandex cards with different positions in neighboring blocks?

Good day. The question is next. How can I connect 2 Yandex cards in neighboring blocks. I connect through the constructor. Here is an example (there are two such blocks):

<div class="map">
<script type="text/javascript" charset="utf-8" async src="https://api-maps.yandex.ru/services/constructor/1.0/js/?um=constructor%XXX&amp;width=100%&amp;height=100%&amp;lang=ru_RU&amp;scroll=false"></script>
</div>

The problem is that the last connected card works.
And when I connect via iframe, I don’t know how to block scroll zoom and drag maps. Are there any iframe options that will help me?
<iframe src="XXX" width="560" height="400" frameborder="0"></iframe>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kn1ght_t, 2018-02-14
@makcimusprime

<script src="http://api-maps.yandex.ru/2.0/?load=package.full&amp;lang=ru-RU" type="text/javascript"></script>
<script type="text/javascript">
  ymaps.ready(init);

  function init() {     
    var myMap = new ymaps.Map("map-1", {
        center: [56.830175456095785, 60.593889812164235], 
        zoom: 16
    });
    myMap.behaviors.disable('scrollZoom', 'drag'); 

    var myMap2 = new ymaps.Map("map-2", {
        center: [56.830175456095785, 60.593889812164235], 
        zoom: 16
    });
    myMap2.behaviors.disable('scrollZoom', 'drag'); 
  }
</script>

and, accordingly, 2 divas for cards:
<div id="map-1" style="height: 500px;"></div>
<div id="map-2" style="height: 500px;"></div>

S
SergejDudn, 2018-02-14
@SergejDudn

Rather, it is better to connect the map via Yandex maps api
https://tech.yandex.ru/maps/doc/jsapi/2.1/quick-st...
And you can connect several and configure each as needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question