Add & remove controls - the high moral map

Control properties 
visible // bool default to true 
OV = new new AMap.OverView (); 
ov.hide (); //ov.show (); Show / Hide --- represents adding and removing controls

 

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.11&key=9de88a718781910c9a1c81230827d1ce&plugin=AMap.Scale,AMap.OverView,,AMap.ToolBar,AMap.Autocomplete"></script>
        <title>控件的添加与删除</title>
        <style>
            *{
                padding: 0;
                margin: 0;
            }
            #container{
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
            }
            #panel{
                position: fixed;
                background: white;
                top: 10px;
                right: 10px;
                width: 280px;
                height: 200px;
            }
            #search{
                width: 200px;
                height: 160px;
                position: absolute;
                left: 10px;
                top: 10px;
                background: white;
            }
        </style>
    </head>
    <body>
        <div id="container"></div>
        <div id="panel">
            <button id="yy">鹰眼</button>
            <button id="gjt">工具条</button>
            <button id="blc">比例尺</button>
        </div>
        
        <script>
            var map = new AMapMap ( ', container ', , { 
                zoom: 11 And , 
                center: [ 116379391 , 39861536 ], 
                
            }); 
            
            var oV =  new AMapOverView ({ 
                visible: set to true, 
            }); 
            var oS =  new AMapScale ();
            var oT =  new AMapToolBar (); 
            map.addControl (oV); 
            map.addControl (oS); 
            map.addControl (oT); 
            
            let yyNode= git = blc = false;
            yy.onclick = function(){
                if(yyNode == true){
                    oV.hide();
                }else{
                    oV.show();
                }
                yyNode = !yyNode;
            };
            
        </script>
    </body>
</html>

 

Guess you like

Origin www.cnblogs.com/rickdiculous/p/11440539.html