0
0
0348raven2016-06-17 11:35:15
JavaScript
0348raven, 2016-06-17 11:35:15

Several Yandex maps on one page with a call when clicking on a class?

Inside a large (even unlimited) number of tabs there is a map, I initialize:

ymaps.ready(function(){

        $('.tab-item').click(function(){

            var myMap;
            initYaMap();

            myMap = new ymaps.Map(document.getElementsByClassName('tracking-map__yandex-map'), {
                center: [53.35, 83.73],
                zoom: 4
            });

        });

    });

    function initYaMap () {

    }

id cannot be used. I believe that instead of a string, you need to pass the found element according to the principle $('.classname')[0]
But nothing comes out. Can anyone come across? Is there a solution to this issue, I'm familiar with the API, I don't need links to it, I'm trying to solve the problem, I'm not asking someone to google instead of me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dom1n1k, 2016-06-17
@dom1n1k

The variable myMap must be an array.
And I would store there not only a link to the map itself, but also a link to its tab and some other similar information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question