我使用的是 rapahel 版本 2.0.0,由于某种原因,图像没有在 IE8 中被拖动(启动和移动被触发,但图像没有移动)没有异常也没有错误......我尝试使用 1.5。 2 它有效,但我没有 onDragOver 和 snapTo 方法,我需要这两种方法!!!
有没有人有同样的问题和解决方法???
这是代码:
var start = function () {
this.onDragOver(function(event){
this.animate({"x":Raphael.snapTo(this.attr("x"), event.attr("x")
+3, 1), "y":Raphael.snapTo(this.attr("y"), event.attr("y")+3, 1)},
100);
if(event.data("bin") == 1){this.animate({"opacity": 0.1}, 1000,
function(){this.remove();});}
});
this.ox = this.type == "rect" || this.type == "image" ?
this.attr("x") : this.attr("cx");
this.oy = this.type == "rect" || this.type == "image" ?
this.attr("y") : this.attr("cy");
this.attr({cursor: "move"});
this.toFront();
};
var move = function (dx, dy) {
this.attr(this.type=="rect" || this.type == "image" ?{x: this.ox +
dx, y: this.oy + dy}:{cx: this.ox + dx, cy: this.oy + dy});
};
var end = function () {
//this.animate({"fill-opacity": 1}, 500);
};
var width = 800, height = 450;
var paper = Raphael("canvas", width, height);
var lbl1 = paper.image("img/label.png", 10, 40, 100, 22);
lbl1.drag(move, start, end);
谢谢!