J
J
Jan2016-02-24 16:08:15
JavaScript
Jan, 2016-02-24 16:08:15

Working with Yandex Api Maps, when creating a map, it gives an error, what is the error?

hello, the console is throwing an error.

TypeError: s is null
in the Yandex file inception.js?1455725732539 I
initialize the map like this:
ymaps.ready(function () {
   myMap = new ymaps.Map("myMap",{
      center: [25.32852, 50.74915], 
      zoom: 14, 
      type: "yandex#map", 
      behaviors: ['default', 'scrollZoom']
   });       
   myMap.controls
       .add("zoomControl")
      .add("mapTools")
      .add(new ymaps.control.TypeSelector(["yandex#map", "yandex#satellite", "yandex#hybrid", "yandex#publicMap"]));
});

What am I doing wrong? Before this, the code worked for 2 months.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nk_pl, 2016-02-24
@nk_pl

myMap is declared?
how do you connect?

1
1amer, 2016-04-10
@1amer

Caught the same error, the problem was in the indefinite width of the map container.
In my case, the container was a td inside a hidden tr.
yamps can work with hidden containers, but it must be able to determine the dimensions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question