Claudio
Claudio

Reputation: 21

RaphaelJS + jQuery: How to define ID and CLASSES for paths

Well, my question is quite simple.

I'm using RaphaelJS to make a country map with hover effects, but how do I get the state ID with hover?

Imagine you have this example path.

var path = paper.path('coordinates_here');

how do I identify this path with jQuery? example:

    $('#myPathId').mouseenter(function(){
       //do something here
    });

Upvotes: 2

Views: 1607

Answers (2)

Hyangelo
Hyangelo

Reputation: 4812

You can use the built-in event binding of Raphaeljs like:

path.mouseover(function (event) {
    //do something
});

or you if you really want to use jQuery to do the event binding, you can do:

$(path.node).mouseenter(function(){
       //do something here
    });

assuming

var path = paper.path('coordinates_here');

Upvotes: 4

treppo
treppo

Reputation: 547

You will find the answer in another post: How to access id attribute of any element in Raphael

By the way: I found it by googling for "raphael path id".

Upvotes: 1

Related Questions