使用jquery开始旋转时如何保持克隆元素的旋转位置

时间:2016-11-03 12:50:28

标签: javascript jquery

当我克隆可旋转元素时,前一个旋转是在克隆元素开始旋转时到达起点.pls帮助这个

var newdiv = $(imageid).parent().clone();
                var id = "div" + divid;
                var imid = "img" + imgid;
                $(newdiv).attr('id', id);
                $(newdiv).find("img:first").attr("id", imid)
                $(newdiv).css("z-index", newZindex);

                $(newdiv).find('.ui-resizable-handle').remove();
                var position = $(imageid).parent().position();
                $(newdiv).addClass("selected clone").css({ "top": position.top + 20, "left": position.left + 20 }).appendTo("#selectable"); 
               $("#" + id).rotatable({ handle: $(newdiv).find('img:last').addClass("rotatable-handle") }, {
                stop: stopHandlerRotate,
                start: startHandlerRotate
            }).resizable({
                handles: "n, e, s, w, nw, ne, sw,se"
            }, {
                stop: stopHandlerResize,
                start: startHandlerResize
            }).draggable({
                stop: stopHandlerDrag,
                start: startHandlerDrag
            });

当我克隆元素时,它就像检查图像cloned一样。 当我点击开始旋转时,它会进入开始位置。检查图片clonedrotate

提前感谢。

1 个答案:

答案 0 :(得分:0)

这里我在重新绑定之前找到了先前的角度,并将其赋予绑定。

$("#" + id).rotatable({ handle: $(newdiv).find('img:last').addClass("rotatable-handle") },{angle:previousangle}, {
                stop: stopHandlerRotate,
                start: startHandlerRotate
            }).resizable({
                handles: "n, e, s, w, nw, ne, sw,se"
            }, {
                stop: stopHandlerResize,
                start: startHandlerResize
            }).draggable({
                stop: stopHandlerDrag,
                start: startHandlerDrag
            });

现在正在运作。