简体   繁体   English

jVectorMap 标记为图标

[英]jVectorMap marker as icon

Does anyone know how to add a Image as Marker in jVectorMap?有谁知道如何在 jVectorMap 中添加图像作为标记?

I read a lot of posts here in stackoverflow resolving the same question, but i couldn't make it.我在 stackoverflow 中阅读了很多帖子来解决相同的问题,但我做不到。

My code is the next one:我的代码是下一个:

 $(function(){ $('#map').vectorMap({ zoomOnScroll: false, scaleColors: ['#C8EEFF', '#0071A4'], hoverOpacity: 0.7, hoverColor: false, backgroundColor: '#6F644E', markers: [ {latLng: [40.4381311, -3.8196209], name: 'Spain'}, ], markerStyle: { initial: { image: 'http://jvectormap.com/img/icon-np-2.png', } }, }); });
 <link rel="stylesheet" href="resources/jquery-jvectormap/jquery-jvectormap-2.0.3.css" type="text/css" media="screen"/> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <script src="resources/jquery-jvectormap/jquery-jvectormap-2.0.3.min.js"></script> <script src="resources/jquery-jvectormap/jquery-jvectormap-world-mill-en.js"></script> <div id="map" class="container-fluid cont-slider">

But when I try to run the code, this error came up everytime:但是当我尝试运行代码时,每次都会出现这个错误:

在此处输入图片说明

Also I want to add I readed this http://jvectormap.com/examples/marker-icons/ but It didn't work.另外我想补充一下我读过这个http://jvectormap.com/examples/marker-icons/但它没有用。

I've faced the same problem.我遇到了同样的问题。 Looks like jVectorMap doesn't support all features of JQuery v.3.xx I've tried all the older versions and found that 2.2.4 is working great.看起来 jVectorMap 不支持 JQuery v.3.xx 的所有功能我已经尝试了所有旧版本,发现 2.2.4 运行良好。 Newest Jquery version could properly work only with non-image markers最新的 Jquery 版本只能与非图像标记一起正常工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM