问题
i'm using the excellent raphaeljs library and after having created a path with
var c = paper.path("M10 10L90 90 ..... z");
i would like to get the position of the click event on the path relative to the canvas. I tried:
c.click(function (event) {
alert(event.pageX);
}));
but that gives me a value which is not relative to raphael's canvas. Any idea? thx
回答1:
Something like
var x = Math.floor((event.pageX-$("#paper").offset().left));
Obviously this is using jQuerys $ to get the paper element..
来源:https://stackoverflow.com/questions/5146133/raphaeljs-accessing-the-relative-postion-of-a-click-on-a-closed-path