嗯,我的問題很簡單。RaphaelJS + jQuery:如何爲路徑定義ID和CLASSES
我正在使用RaphaelJS製作懸停效果的國家地圖,但我如何獲得懸停狀態ID?
想象一下,你有這個例子路徑。
var path = paper.path('coordinates_here');
如何用jQuery識別這條路徑? 例如:
$('#myPathId').mouseenter(function(){
//do something here
});
嗯,我的問題很簡單。RaphaelJS + jQuery:如何爲路徑定義ID和CLASSES
我正在使用RaphaelJS製作懸停效果的國家地圖,但我如何獲得懸停狀態ID?
想象一下,你有這個例子路徑。
var path = paper.path('coordinates_here');
如何用jQuery識別這條路徑? 例如:
$('#myPathId').mouseenter(function(){
//do something here
});
你會發現在另一篇文章中回答:How to access id attribute of any element in Raphael
順便說一句:我發現它通過google搜索「拉斐爾路徑ID」。
您可以使用內置的事件像Raphaeljs結合:
path.mouseover(function (event) {
//do something
});
或你,如果你真的想使用jQuery做事件綁定,你可以這樣做:
$(path.node).mouseenter(function(){
//do something here
});
假設
var path = paper.path('coordinates_here');