jQuery: jQuery event with RaphaelJs
February 5th, 2010 by jeremychoneHTML
<div id="rtest"> </div>
Javascript code
<script type="text/javascript">
$(document).ready(function(){
var paper = Raphael("rtest", 320, 200);
var circle = paper.circle(50, 40, 30);
circle.attr({
"stroke": "#336699",
"fill": "#fbfbfb"
});
$(circle.node).click(function(){
var circle = this.raphael;
//Toggle the circle fill color
if (circle.attr("fill") == "#333333") {
circle.attr("fill", "#fbfbfb");
} else {
circle.attr("fill", "#333333");
}
});
});
</script>
See RaphaelJs Event doc