Google Maps API v3 - how to detect when map changes to full screen mode?

后端 未结 4 933
盖世英雄少女心
盖世英雄少女心 2020-12-07 01:41

Is there a way to detect when the user clicks the default fullscreen mode button?

These are the map options I\'m using:

var mapOptions = {
                   


        
4条回答
  •  时光说笑
    2020-12-07 02:09

    This solution it is working for me:

    /** Full Screen event */
    
    $(document).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function() {
        var isFullScreen = document.fullScreen ||
            document.mozFullScreen ||
            document.webkitIsFullScreen;
        if (isFullScreen) {
            console.log('fullScreen!');
        } else {
            console.log('NO fullScreen!');
        }
    });
    

提交回复
热议问题