Jvectormap -在预定义为选中的区域上禁用onclick事件



就像这样的例子:http://jvectormap.com/examples/regions-selection/,您可以这样预定义选定的区域:

selecteregions: ["Hessen", "Bayern"]

但是,我想禁用这些区域,因此在我将它们预定义为选中后,它们不能被单击或改变状态。

有谁知道如何完成这样的事情吗?

谢谢!

返回false或事件,以防止默认的区域,以禁用鼠标在该特定区域上的进一步事件。像明智的所有事件,如标记结束,标记点击等。

jQuery('#map1').bind('regionOver.jvectormap',function(event, code)
{
  if(code == 'US')
  {
     return false ; // if mouse over on 'US' region it will stop further events. like disable
  }
}

这许多帮助你。

旧的帖子,但不是黑客进入鼠标事件,你可以禁用区域上的事件点击(预定义)。

注意:

/**
 * jVectorMap version 2.0.4
 *
 * Copyright 2011-2014, Kirill Lebedev
 *
 */

禁用区域点击事件:

var yourMap = new jvm.Map({
    map: 'world_mill_en',
    container: $('#map'),
    ....
    ....
    onRegionClick: function (e, code) {
        // check your code here
        if (code == 'somethingYouWantToDisable') {
            e.preventDefault();
        }            
    }
});

如果您需要禁用有关区域的其他事件,请查看这些:

    onRegionTipShow: function (e, label, code) {
        e.preventDefault();
    },
    onRegionSelected: function (e, code, isSelected, selectedRegions) {
        e.preventDefault();
    }

最新更新