Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

OnRegionClick and event.preventDefault #99

Open
LorenDorez opened this Issue · 2 comments

3 participants

LorenDorez sebastian herrera Darren Felton
LorenDorez

Ho I am trying to prevent the clicking of certain states but it isnt working.

After further debugging this code always returns false

!regionClickEvent.isDefaultPrevented()

If i check this its true..

e.originalEvent.defaultPrevented
sebastian herrera

you have to define those state codes like this:

onRegionClick: function (element,code,region,event)
{
if (code == "tx" ||
code == "fl")
event.preventDefault();}

Darren Felton

@sebastianherrera Good day to you. I'm having trouble implementing this for jqvmap's world map. The exact same logic works fine on my USA and Canada map, however for some reason the World map, event is undefined? Any ideas what's going on

For example:

onRegionClick: function(element,code,region,event)
{
alert(event); // Alerts "undefined", tells me it wasn't passed to the function
event.preventDefault(); // Throws error "Cannot read property 'preventDefault' of undefined.
}

Strangely enough, it does work for onRegionOver of the same map.

onRegionOver: function(event, code, region) {
event.preventDefault();
}

Roman Sukochev Leolik referenced this issue from a commit in Leolik/jqvmap
Leolik #99 3beca2f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.