Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

Creating maps on demand

Save as filesEdit on JSFiddle

In this example, the map is created when the "Show map" button is clicked.

At first, an empty div container is placed on the page. The bind() function is used for the "button" element to assign a handler for the click event, which creates the map and puts it in the specified container when called.

If the map has already been created when the button is clicked, the destroy() method is called and it destroys the map.

Пишете на JavaScript? У нас есть вакансии
Mon Oct 31 2022 13:07:25 GMT+0300 (Moscow Standard Time)