jquery draggable和resizable不适用于克隆的div [英] jquery draggable and resizable is not working on cloned div

查看:116
本文介绍了jquery draggable和resizable不适用于克隆的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 div ,具有 jQuery UI 的可拖动和可调整大小的功能。我克隆 div 并将其附加到同一父母:

I have a div with draggable and resizable functionality of jQuery UI. I clone the div and append it to the same parent:

<div class="drag resize"> ... </div>

$(".drag").live("mouseenter", function() { $(this).draggable(); });
$(".resize").live("mouseenter", function() { $(this).resizable(); });

$("div").clone(true).appendTo($("div").parent());

克隆已成功创建,但当我尝试拖动它时,orignal会拖动。调整大小也不起作用。谁能解释一下这里发生了什么?

The clone is created successfully, but when I am trying to drag it, the orignal one drags. Resizing is also not working. Can anybody explain me what is happening here?

推荐答案

你可能想看看这篇SO帖子jQuery UI可调整大小的克隆元素(.clone(true))不会调整大小
- 在为我工作的克隆元素上应用resizable()之前删除resize处理程序

You might like to look at this SO post jQuery UI resizable cloned element(.clone(true)) doesn't resize - the removal of the resize handlers before applying a resizable() on the cloned element worked for me

这篇关于jquery draggable和resizable不适用于克隆的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆