【发布时间】:2021-04-28 07:27:32
【问题描述】:
jquery中如何同时设置'draggable'和'resizable'?
以下代码只移动一次,不再移动。
我想继续移动和调整大小,我该怎么办?
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="style/result.css?v=1.3" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<%@ page import = "java.io.*" %>
<script type="text/javaScript" >
$(function(){
var counts = [0];
$(".dragImg").draggable({
helper: "clone",
//Create counter
start: function() { counts[0]++; }
});
$("#dropHere1").droppable({
drop: function(e, ui){
$(this).append($(ui.helper).clone());
$(ui.helper).clone().draggable();
$("#dropHere1 .dragImg").addClass("item-"+counts[0]);
$("#dropHere1 .item-"+counts[0]).removeClass("dragImg ui-draggable ui-draggable-dragging");
$(".item-"+counts[0]).dblclick(function() {
$(this).remove();
}).resizable();
}
});
});
</script>
<img src="https://t1.daumcdn.net/cfile/tistory/234774445960F69422" class="dragImg" width="90" height="90" >
<div id="dropHere1" ></div>
【问题讨论】:
-
请查看link
-
这个问题是 10 年前发布的
-
这能回答你的问题吗? Jquery Draggable AND Resizable
-
链接中的代码不起作用。这是我的代码(上),我应该如何应用它?
标签: javascript html jquery css