问题
A friend of mine is having some issues while trying to attach click and double click events simultaneously to do different things each own for a certain layer. He is trying to do it with raphael.js and openlayers.js libraries with no success. We did some research and the solutions on this post: on click stopped by doubleclick aren't working completely.
Is there an efficient way to do this?
Thanks in advance.
回答1:
Are you looking for this:
var paper = Raphael('area', 300, 300);
var r = paper.rect(100, 100, 70, 35, 5).attr({fill: 'red'});
r.click(function() {
this.animate({fill: 'blue'}, 200);
});
r.dblclick(function() {
this.animate({fill: 'green'}, 200);
});
来源:https://stackoverflow.com/questions/17370963/way-to-attach-click-and-double-click-events-succesfully-using-raphael-js-openlay