如何破坏矢量图?

问题描述 投票:0回答:1

有没有办法摧毁jvector地图?我希望能够根据用户点击动态加载地图。

这是插件链接:

http://jvectormap.com/

jvectormap
1个回答
0
投票

jVectorMap有一个remove方法(参考:jVectorMap -> JavaScript API -> Map):

/**
  * Gracefully remove the map and and all its accessories, unbind event handlers.
*/
remove: function(){
  this.tip.remove();
  this.container.remove();
  jvm.$('body').unbind('mouseup', this.onContainerMouseUp);
}

你可以像这样使用它:

var mapObj = $("#worldMap").vectorMap('get','mapObject');
mapObj.remove();
© www.soinside.com 2019 - 2024. All rights reserved.