【发布时间】:2015-09-25 22:19:13
【问题描述】:
我有以下小提琴: http://jsfiddle.net/zugzq7vv/
我要做的是能够将输入框左侧的数字1拖到正方形的中心,使正方形变为黑色,数字变为白色。
RaphaelJS 2.1 如何做到这一点?
JS代码:
// Creates canvas 320 × 200 at 10, 50
var paper = Raphael(document.getElementById("papercanvas"), 320, 200);
var circle = paper.rect(50, 40, 50, 50);
// Sets the fill attribute of the circle to red (#f00)
circle.attr("fill", "#f00");
// Sets the stroke attribute of the circle to white
circle.attr("stroke", "#fff");
var t = paper.text(75, 65,""); //I want this empty string to be a text I drag
还有简单的 HTML:
1<input id="teste" disabled></input>
<div id="papercanvas"></div>
我知道拖放界面,但我似乎无法将其应用于单个数字。
【问题讨论】:
-
看看这个问题/答案:stackoverflow.com/q/3675519/830125
标签: javascript raphael