jvectormap标记 [英] jvectormap markers

查看:74
本文介绍了jvectormap标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jvectormap显示与我合作的业务相关的校友位置。是否有添加标记链接的解决方案?我的意思是,对于每个单独的标记,我知道您可以使用此代码将所有标记链接到一个URL(作为示例):

I'm using jvectormap to show the locations of alumni related to the business I work with. Is there a solution to add links to markers? By that I mean for each individual marker, I am aware you can use this code to link all markers to one URL (as an example):

 onMarkerClick: function (event, code){
   var url = "http://www.google.com";
   $(location).attr('href',url);
 },

我安排了这样的标记: US:{latLng:[38.90,-98.45],名称:'美利坚合众国'} ,如果这有任何区别。

I've arranged my markers like this: "US": {latLng: [38.90, -98.45], name: 'United States of America'}, if this makes any difference.

我希望为每个标记使用唯一的网址。因此,USA链接到专门针对美国的页面。目前,我可以使用上面的代码将所有标记链接到单个URL,当我尝试执行多个国家时遇到问题。

I'm looking to use a unique URL for each marker. So USA links to a page dedicated for the USA for example. Currently I am able to link all markers to a single URL using the above code, it's when I try doing more than one country that I run into issues.

提前感谢,

汤姆。

推荐答案

你可以这样做

onMarkerSelected: function(){
   // do what you need to do here.
}

示例如下:
http://jvectormap.com/examples/regions-selection/

在您的标记中添加网址:

In your marker add the URL:

"US": {latLng: [38.90, -98.45], name: 'United States of America', weburl : "/blah/foo"}

然后当你有你的功能时:

then when you have your function:

onMarkerClick: function(events, index) {
    $(location).attr('href', markers[index].weburl);
}

标记是您的标记数组。

这篇关于jvectormap标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆