Skip to content

Instantly share code, notes, and snippets.

@pixelhijack
Created March 19, 2014 08:46
Show Gist options
  • Save pixelhijack/9637841 to your computer and use it in GitHub Desktop.
Save pixelhijack/9637841 to your computer and use it in GitHub Desktop.
/*
HELPER - extend raphael: draggable elements
*/
Raphael.el.draggable = function(){
//state
this.attr({cursor: "move"});
this.drag(
//move
function(dx,dy){
this.attr({x: this.ox + dx, y: this.oy + dy});
},
//start
function(){
this.ox = this.attr("x");
this.oy = this.attr("y");
//state
this.attr({opacity: 0.4});
},
//stop
function(){
//state
this.attr({opacity: 1});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment