我正在使用jVectorMap插件,我想通过另一个函数触发标记.我该怎么称呼那一行 map.addMarker( index, markers[index], [values1[index], values2[index]] ); ?
$("#target").click(function() {
**Here should that addMarker function included**
});
Run Code Online (Sandbox Code Playgroud)
这是代码的一部分,其中标记由复选框触发:
$('.list-markers :checkbox').change(function(){
var index = $(this).closest('li').attr('data-marker-index');
if ($(this).prop('checked')) {
map.addMarker( index, markers[index], [values1[index], values2[index]] );
} else {
map.removeMarkers( [index] );
}
});
Run Code Online (Sandbox Code Playgroud)
非常感谢