cxzhyx的gravatar头像
cxzhyx 2016-07-28 15:50:11

网页嵌入百度地图和调用百度地图api展示拥堵代码

XX城市路况拥堵图

网页嵌入百度地图和调用百度地图api展示拥堵代码

<html>
<head>
    <title>兰州市实时路况</title>
    <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/TrafficControl/1.4/src/TrafficControl_min.js"></script>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/lz_traffice_map.js"></script>
    <script type="text/javascript">
    $(function() {
        var map = new BMap.Map("mapContainer");
        map.centerAndZoom(new BMap.Point(103.840745,36.067329), 16); 
        var ctrl = new BMapLib.TrafficControl({
            showPanel: false
        });      

        map.addControl(new BMap.NavigationControl());
        map.enableContinuousZoom(false); 
        map.enableScrollWheelZoom(false); 


        map.addControl(ctrl);
        ctrl.setAnchor(BMAP_ANCHOR_BOTTOM_RIGHT);  
        ctrl.showTraffic();

    });

    //按坐标移动
    function goPosition(xPos,yPos){
        var mapa = new BMap.Map("mapContainer");
        mapa.centerAndZoom(new BMap.Point(xPos,yPos), 16); 
        var ctrla = new BMapLib.TrafficControl({
            showPanel: false
        });
            
        mapa.addControl(new BMap.NavigationControl());
        mapa.enableContinuousZoom(false); 
        mapa.enableScrollWheelZoom(true); 

        mapa.addControl(ctrla);
        ctrla.setAnchor(BMAP_ANCHOR_BOTTOM_RIGHT); 
        ctrla.showTraffic();
    }
    </script>
    <style type="text/css">
    #mapContainer {width:949px;height:500px;}
    .traffic_container {width:1010px;background-color:#FFF;}
    .left_map_container{float:left;width:949px;border:1px solid #1970CF;}
    .left_map_container h4{display:block;width:949px;height:33px;line-height:33px;text-indent:12px; overflow:hidden;padding:0px;margin:0px;background:url('images/bg1.gif') repeat-x left top;color:#FFF;}
    .left_map_container h4 .traffic_status_icon {float:right;width:110px;height:34px;margin-top:0px;background:url('images/traffic_status.png') no-repeat center center;}
    .BMap_cpyCtrl{display:none;}.anchorBL{display:none;}
    </style>
</head>

<body>
<!--内容开始-->
<div class="traffic_container">
    <div class="left_map_container">
        <h4>兰州市实时路况<span class="traffic_status_icon"></span></h4>
        <div id="mapContainer"></div>
    </div>
</div>
<div style="color:#444;font-size:12px;padding:10px 3px;">实时路况</div>
</body>
</html>


打赏

已有1人打赏

frankieing的gravatar头像

文件名:lz_traffic.rar,文件大小:57.854K 下载
  • /
      • /lz_traffic
          • /lz_traffic/images
            • /lz_traffic/images/Thumbs.db
            • /lz_traffic/images/bg1.gif
            • /lz_traffic/images/bg2.gif
            • /lz_traffic/images/traffic_status.png
          • /lz_traffic/js
              • /lz_traffic/js/dtree
                • /lz_traffic/js/dtree/dtree.css
                • /lz_traffic/js/dtree/lz_traffice_map.js
            • /lz_traffic/js/jquery.min.js
            • /lz_traffic/js/lz_traffice_map.js
        • /lz_traffic/lz_traffic_map.html
最代码最近下载分享源代码列表最近下载
zxdmzch  LV1 2022年8月29日
唐僧洗头爱飘柔  LV22 2022年7月26日
huaua7676  LV30 2021年7月31日
Huáng  LV1 2021年7月1日
sevemiss  LV2 2021年6月2日
wrtnngsz  LV1 2021年3月10日
你为我着迷丶  LV18 2020年7月13日
后端开发  LV1 2020年6月17日
klc9999  LV1 2020年6月9日
陈齐尧  LV11 2019年10月31日
最代码最近浏览分享源代码列表最近浏览
哈哈082378624  LV1 3月21日
微信网友_6801903754432512 2023年12月31日
暂无贡献等级
edpwyg  LV14 2023年10月21日
18276177062  LV1 2023年6月12日
xietongkaifa 2023年4月16日
暂无贡献等级
DATA123 2023年3月15日
暂无贡献等级
xiexiaoming05  LV14 2022年11月16日
sky丶小十  LV7 2022年10月14日
157226747  LV16 2022年9月27日
Sentro  LV1 2022年9月7日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友