<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/library/MarkerClusterer/1.2/src/MarkerClusterer_min.js"></script>
    <title>24.1在加载过程中,根据回调函数结果中第一个点设置为中心点</title>
</head>
<body>
    <div class="wrapper">
        <div class="container clearfix">
            <div class="clearfix">
                <div style="clear: both;">
                    <div style="float: left; width: 500px; height: 340px; border: 1px solid gray" id="container">
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 16);

    function myFun() {
        var point = local.getResults().getPoi(0).point;
        map.centerAndZoom(point, 18);
    }
    var local = new BMap.LocalSearch(map, {
        onSearchComplete: myFun
    });
    local.search("酒仙桥");
</script>

  

百度地图 在加载过程中,根据回调函数结果中第一个点设置为中心点

 

相关文章:

  • 2022-12-23
  • 2021-10-16
  • 2021-05-30
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
相关资源
相似解决方案