zoukankan      html  css  js  c++  java
  • 高德地图-添加自定义图标

    1. <!DOCTYPE html>  
    2. <html>  
    3.     <head>  
    4.         <meta charset="UTF-8">  
    5.         <meta http-equiv="X-UA-Compatible" content="IE=edge">  
    6.         <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">  
    7.         <title>高德地图-添加自定义图标</title>  
    8.         <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>  
    9.         <script type="text/javascript" src="../js/jquery-1.12.3.js" ></script>  
    10.         <script src="http://webapi.amap.com/maps?v=1.3&key=c2eb520334ddc5ab2bb70a3afe6a58cc"></script>  
    11.         <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>  
    12.         <style>  
    13.             body,html{  
    14.                  99%;  
    15.                 height: 99%;  
    16.                 font-family: "微软雅黑";  
    17.                 font-size: 12px;  
    18.                 font-size-adjust: initial;  
    19.             }  
    20.             #keyMap{  
    21.                  100%;  
    22.                 height: 100%;  
    23.                 font-family: "arial rounded mt bold";  
    24.                 font-size: -webkit-xxx-large;  
    25.             }  
    26.         </style>  
    27.     </head>  
    28.     <body>  
    29.         <div id="keyMap"></div>  
    30.         <div class="button-group">  
    31.             <input type="button" class="button" id="addTag" value="添加点标记"/>  
    32.         </div>  
    33.         <script>  
    34.             var marker;  
    35.             var map = new AMap.Map("keyMap",{  
    36.                 resizeEnable: true,  
    37.                 center: [114.297199,30.573714],  
    38.                 zoom: 13  
    39.             });  
    40.               
    41.             AMap.event.addDomListener(document.getElementById('addTag'), 'click', function() {  
    42.                 addTags();  
    43.             }, false);  
    44.               
    45.             function addTags()  
    46.             {  
    47.                 if(marker)  
    48.                 {  
    49.                     return;  
    50.                 }  
    51.                 marker = new AMap.Marker({  
    52.                     icon:"../img/ooopic_1464187636.png",  //路径
    53.                size: new AMap.Size(40, 50),//图片大小
    54.                     position:[114.297199,30.573714]  //图片出现的经纬度
    55.                 });  
    56.                   
    57.                 marker.setMap(map);  
    58.             }  
    59.         </script>  
    60.     </body>  
    61. </html
  • 相关阅读:
    九种常用排序的性能分析总结
    C语言输出格式总结
    线程安全的单例模式
    反射原理
    二进制的计算(计算机为什么采用补码存储数据)
    java程序员必须会的技能
    09网易校园招聘笔试题
    Spring获取ApplicationContext方式,和读取配置文件获取bean的几种方式
    【转】策略与机制分离
    VM PowerCli的简单安装和使用学习
  • 原文地址:https://www.cnblogs.com/wplcc/p/6744797.html
Copyright © 2011-2022 走看看