pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <i id='nuBw3'><tr id='nuBw3'><dt id='nuBw3'><q id='nuBw3'><span id='nuBw3'><b id='nuBw3'><form id='nuBw3'><ins id='nuBw3'></ins><ul id='nuBw3'></ul><sub id='nuBw3'></sub></form><legend id='nuBw3'></legend><bdo id='nuBw3'><pre id='nuBw3'><center id='nuBw3'></center></pre></bdo></b><th id='nuBw3'></th></span></q></dt></tr></i><div class="zfl7rl5" id='nuBw3'><tfoot id='nuBw3'></tfoot><dl id='nuBw3'><fieldset id='nuBw3'></fieldset></dl></div>
      <legend id='nuBw3'><style id='nuBw3'><dir id='nuBw3'><q id='nuBw3'></q></dir></style></legend>

      <small id='nuBw3'></small><noframes id='nuBw3'>

          <bdo id='nuBw3'></bdo><ul id='nuBw3'></ul>
        <tfoot id='nuBw3'></tfoot>
      1. Leaflet.js - 點擊時設置標記,拖動時更新位置

        leaflet.js - Set marker on click, update position on drag(Leaflet.js - 點擊時設置標記,拖動時更新位置)

            <legend id='gaGMy'><style id='gaGMy'><dir id='gaGMy'><q id='gaGMy'></q></dir></style></legend>
              <tbody id='gaGMy'></tbody>

            <small id='gaGMy'></small><noframes id='gaGMy'>

                • <bdo id='gaGMy'></bdo><ul id='gaGMy'></ul>
                • <i id='gaGMy'><tr id='gaGMy'><dt id='gaGMy'><q id='gaGMy'><span id='gaGMy'><b id='gaGMy'><form id='gaGMy'><ins id='gaGMy'></ins><ul id='gaGMy'></ul><sub id='gaGMy'></sub></form><legend id='gaGMy'></legend><bdo id='gaGMy'><pre id='gaGMy'><center id='gaGMy'></center></pre></bdo></b><th id='gaGMy'></th></span></q></dt></tr></i><div class="zzfld7d" id='gaGMy'><tfoot id='gaGMy'></tfoot><dl id='gaGMy'><fieldset id='gaGMy'></fieldset></dl></div>
                  <tfoot id='gaGMy'></tfoot>

                • 本文介紹了Leaflet.js - 點擊時設置標記,拖動時更新位置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  對于我正在處理的一個小項目,我需要能夠在 Leaflet.js 驅動的圖像地圖上放置一個標記,并在它被拖動時更新該標記的位置.我使用下面的代碼來嘗試這個,但它失敗了.我收到錯誤未定義標記".我不知道為什么它不起作用 - 也許你們可以幫助我?;)

                  for a small project I am working on, I need to be able to place a marker on a leaflet.js powered image-map and update the position of this marker, if it gets dragged. I use the following code to try this, but it fails. I get the error 'marker not defined'. I don't know why it's not working - maybe you guys could help me out? ;)

                  function onMapClick(e) {
                      gib_uni();
                      marker = new L.marker(e.latlng, {id:uni, icon:redIcon, draggable:'true'};
                      map.addLayer(marker);
                  };
                  
                  marker.on('dragend', function(event){
                      var marker = event.target;
                      var position = marker.getLatLng();
                      alert(position);
                      marker.setLatLng([position],{id:uni,draggable:'true'}).bindPopup(position).update();
                  });
                  

                  推薦答案

                  在上面的代碼片段中,在添加事件處理程序時沒有定義標記.在創建標記后立即添加 dragend 偵聽器,請嘗試以下操作:

                  In the code snippet above, marker is not defined at the time the event handler is added. Try the following where the dragend listener is added immediately following the creation of the Marker:

                  function onMapClick(e) {
                      gib_uni();
                      marker = new L.marker(e.latlng, {id:uni, icon:redIcon, draggable:'true'});
                      marker.on('dragend', function(event){
                              var marker = event.target;
                              var position = marker.getLatLng();
                              console.log(position);
                              marker.setLatLng(position,{id:uni,draggable:'true'}).bindPopup(position).update();
                      });
                      map.addLayer(marker);
                  };
                  

                  您的新 L.Marker() 行末尾還缺少一個括號.

                  You were also missing a bracket at the end of your new L.Marker() line.

                  您還在 setLatLng 調用中將 position 放入了一個數組中,但它已經是一個 LatLng 對象.

                  You also put position into an array in the call to setLatLng but it is already a LatLng object.

                  這篇關于Leaflet.js - 點擊時設置標記,拖動時更新位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)

                  <small id='5gH73'></small><noframes id='5gH73'>

                • <legend id='5gH73'><style id='5gH73'><dir id='5gH73'><q id='5gH73'></q></dir></style></legend>
                    <bdo id='5gH73'></bdo><ul id='5gH73'></ul>

                      <tfoot id='5gH73'></tfoot>

                      • <i id='5gH73'><tr id='5gH73'><dt id='5gH73'><q id='5gH73'><span id='5gH73'><b id='5gH73'><form id='5gH73'><ins id='5gH73'></ins><ul id='5gH73'></ul><sub id='5gH73'></sub></form><legend id='5gH73'></legend><bdo id='5gH73'><pre id='5gH73'><center id='5gH73'></center></pre></bdo></b><th id='5gH73'></th></span></q></dt></tr></i><div class="r7hx577" id='5gH73'><tfoot id='5gH73'></tfoot><dl id='5gH73'><fieldset id='5gH73'></fieldset></dl></div>
                          <tbody id='5gH73'></tbody>
                          1. 主站蜘蛛池模板: 旅游规划_旅游策划_乡村旅游规划_景区规划设计_旅游规划设计公司-北京绿道联合旅游规划设计有限公司 | 电动卫生级调节阀,电动防爆球阀,电动软密封蝶阀,气动高压球阀,气动对夹蝶阀,气动V型调节球阀-上海川沪阀门有限公司 | 济南网站策划设计_自适应网站制作_H5企业网站搭建_济南外贸网站制作公司_锐尚 | C形臂_动态平板DR_动态平板胃肠机生产厂家制造商-普爱医疗 | 硫化罐-胶管硫化罐-山东鑫泰鑫智能装备有限公司 | 涡街流量计_LUGB智能管道式高温防爆蒸汽温压补偿计量表-江苏凯铭仪表有限公司 | 西门子伺服电机维修,西门子电源模块维修,西门子驱动模块维修-上海渠利 | 四川成都干燥设备_回转筒干燥机_脉冲除尘器_输送设备_热风炉_成都川工星科机电设备有限公司 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 三佳互联一站式网站建设服务|网站开发|网站设计|网站搭建服务商 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | ★济南领跃标识制作公司★济南标识制作,标牌制作,山东标识制作,济南标牌厂 | 福州甲醛检测-福建室内空气检测_环境检测_水质检测-福建中凯检测技术有限公司 | 蓝鹏测控平台 - 智慧车间系统 - 车间生产数据采集与分析系统 | 钢格板_钢格栅_格栅板_钢格栅板 - 安平县鑫拓钢格栅板厂家 | 河南不锈钢水箱_地埋水箱_镀锌板水箱_消防水箱厂家-河南联固供水设备有限公司 | 走心机厂家,数控走心机-台州博城智能科技有限公司 | MVR蒸发器厂家-多效蒸发器-工业废水蒸发器厂家-康景辉集团官网 | 踏板力计,制动仪,非接触多功能速度仪,逆反射系数测试仪-创宇 | 上海租奔驰_上海租商务车_上海租车网-矢昂汽车服务公司 | 佛山市德信昌电子有限公司 | QQ房产导航-免费收录优秀房地产网站_房地产信息网 | 郑州墨香品牌设计公司|品牌全案VI设计公司 | 空压机商城|空气压缩机|空压机配件-压缩机网旗下商城 | 综合管廊模具_生态,阶梯护坡模具_检查井模具制造-致宏模具厂家 | 外观设计_设备外观设计_外观设计公司_产品外观设计_机械设备外观设计_东莞工业设计公司-意品深蓝 | 复盛空压机配件-空气压缩机-复盛空压机(华北)总代理 | 钢衬玻璃厂家,钢衬玻璃管道 -山东东兴扬防腐设备有限公司 | 微量水分测定仪_厂家_卡尔费休微量水分测定仪-淄博库仑 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 桐城新闻网—桐城市融媒体中心主办 | 轴承振动测量仪电箱-轴承测振动仪器-测试仪厂家-杭州居易电气 | 中细软知识产权_专业知识产权解决方案提供商 | 直流大电流电源,燃料电池检漏设备-上海政飞 | 无压烧结银_有压烧结银_导电银胶_导电油墨_导电胶-善仁(浙江)新材料 | 水上浮桥-游艇码头-浮动码头-游船码头-码瑞纳游艇码头工程 | 球盟会·(中国)官方网站 | 新能源汽车电机定转子合装机 - 电机维修设备 - 睿望达 | 陕西华春网络科技股份有限公司 | 德州网站制作 - 网站建设设计 - seo排名优化 -「两山建站」 | 气象监测系统_气象传感器_微型气象仪_气象环境监测仪-山东风途物联网 | 福尔卡(北京)新型材料技术股份有限公司 |