开发者

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:

    $('#myPathI开发者_如何学运维d').mouseenter(function(){
       //do something here
    });


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');


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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜