码迷,mamicode.com
首页 > 其他好文 > 详细

高德地图——根据兴趣点切换地图

时间:2019-08-28 22:21:37      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:set   har   let   amp   border   sele   height   select   pointer   

技术图片

 

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>高德地图</title>
        <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.11&key=9de88a718781910c9a1c81230827d1ce&plugin=AMap.Autocomplete,AMap.PlaceSearch"></script>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
                list-style: none;
            }
            #container{
                width: 100%;
                height: 100%;
                position: absolute;
                left: 0;
                top: 0;
            }
            #setZoomNode,#setCenterNode{
                width: 280px;
                position: absolute;
                z-index: 99;
                right: 20px;
                top: 50px;
                border: 1px solid black;
                box-shadow: 0 0 5px black;
                background: white;
            }
            #setCenterNode{
                top: 50px;
            }
            #node li{
                cursor: pointer;
            }
            #searchNode{
                width: 280px;
                height: 30px;
                background: white;
                position: absolute;
                top: 20px;
                right: 20px;
            }
        </style>
    </head>
    <body>
        <div id="container"></div>
        <div id="searchNode">
            <input type="" name="" id="searchInput" />
            
        </div>
        
        
        <script type="text/javascript">
            var map = new AMap.Map(container,{
                zoom:10,
                center:[121,30]
            });
            
            var searchNode = new AMap.Autocomplete({
                input:searchInput
            });
            
            var placeSearch = new AMap.PlaceSearch({
                map:map
            });
            
            AMap.event.addListener(searchNode,select,function(e){
                console.log(e);
                placeSearch.search(e.poi.name);
            });
            
        </script>
    </body>
</html>

 

高德地图——根据兴趣点切换地图

标签:set   har   let   amp   border   sele   height   select   pointer   

原文地址:https://www.cnblogs.com/rickdiculous/p/11426840.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!