jvectormap标记
我正在使用jvectormap来显示与我合作的业务相关的校友的位置。 是否有添加标记链接的解决方案? 我的意思是对于每个单独的标记,我知道您可以使用此代码将所有标记链接到一个URL(作为示例):
onMarkerClick: function (event, code){ var url = "http://www.google.com"; $(location).attr('href',url); },
我安排了这样的标记: "US": {latLng: [38.90, -98.45], name: 'United States of America'}
,如果这有任何区别的话。
我希望为每个标记使用唯一的URL。 因此,USA链接到专门针对美国的页面。 目前,我可以使用上面的代码将所有标记链接到单个URL,当我尝试不止一个国家遇到问题时。
提前致谢,
汤姆。
你可以这样做
onMarkerSelected: function(){ // do what you need to do here. }
示例如下: http : //jvectormap.com/examples/regions-selection/
在您的标记中添加url:
"US": {latLng: [38.90, -98.45], name: 'United States of America', weburl : "/blah/foo"}
那么当你有你的function:
onMarkerClick: function(events, index) { $(location).attr('href', markers[index].weburl); }
标记是你的标记数组。