D
D
DonTraffic2021-10-14 11:46:53
JavaScript
DonTraffic, 2021-10-14 11:46:53

How to call a large screen on a custom button in Yandex maps on click?

How to call a large screen on a custom button in Yandex maps on click?
My code looks like this:

ymaps.ready(init);

            function init () {
                var myMap = new ymaps.Map('map', {
                    center: [59.220501, 39.891523], 
                    zoom: 12,
                    controls: ['fullscreenControl']
                }, {
                    searchControlProvider: 'yandex#search'
                })

                var btnFullscreen = new ymaps.control.Button({
                    options: {
                        layout: ymaps.templateLayoutFactory.createClass(
                            "<div class='customZoomBtn'>fullscreen<div/>"
                        ),
                        maxWidth: 150
                    }
                });
                myMap.controls.add(btnFullscreen, {
                    float: 'none',
                    position: {
                        bottom: '25px',
                        right: '25px'
                    }
                });
                btnFullscreen.events.add('click', function (event) {
                    myMap.enterFullscreen()
                });

                myMap.geoObjects.add(new ymaps.Placemark([59.220501, 39.891523], {
                    balloonContent: 'цвет <strong> какой то</strong>',
                    iconCaption: 'текст 2'
                }, {
                    preset: 'islands#blueCircleDotIconWithCaption'
                }));

            }

The problem when clicking, writes that there is no such function.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-10-14
@0xD34F

myMap.enterFullscreen()

You didn't read the documentation carefully. This method does not belong to the map itself, but to map.container .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question