Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="meh">
  </div>
  
  </body>
</html>
 
svg, path {
  position: absolute;
}
 
var move = function(dx,dy){
        //console.log("Move: %f,%f", dx.toFixed(2), dy.toFixed(2) );
        this.translate( dx-this.ox, dy-this.oy );
        this.ox = dx;
        this.oy = dy;
    },
    start = function(){
        this.ox = 0;
        this.oy = 0;
    },
    end = function(){
    };
var $div = $('<div style="border:1px solid black;height:105px;width:105px; background:url(http://static.jsbin.com/images/favicon.png)">');
$('#meh').append($div);
$div.draggable();
var paper=Raphael("meh",300,300);
var path = paper.path("M0,0M 58.83,123.5 235.5,161.83 167.17,48.5z");
path.attr("fill","url(http://static.jsbin.com/images/favicon.png)");
path.patternTmp = path.pattern;
delete path.pattern;
path.drag(move,start,end);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers