大家好,我正在尝试制作一些可拖动的 div,并且我已经成功地使用 jquery-ui 做到了这一点。我还有一个脚本可以删除 2 个 div 并将它们组合成一个(就像它们已合并在一起一样)但是当我在新的“合并”div 上调用可拖动函数时,我得到的错误是标题...所以问题是什么 ?.draggable 函数怎么可能在一个地方工作而不是在另一个地方(在同一个文件上)!
这是可拖动的功能:
function drag($class){
$("."+$class).draggable({
containment: ".tab-content",
grid: [ 3, 3 ],
zIndex:100,
obstacle: "#nothere",
preventCollision: true,
drag:
function(){
$(".test").css("background-color","red");
$(this).css("background-color","green");
}
});
}
Run Code Online (Sandbox Code Playgroud)
首先我为测试类调用它,它完美地工作,没有错误
drag("test");
Run Code Online (Sandbox Code Playgroud)
但是当我在合并函数中再次调用它时,它返回错误:Uncaught TypeError: $(...).draggable is not a function
drag("test:not(.ui-draggable)");
Run Code Online (Sandbox Code Playgroud)
js文件被正确加载:
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
Run Code Online (Sandbox Code Playgroud) 嘿家伙我想在我的网页上设置一个日期选择器,并禁用它的一些日期,所以它不能显示
这是代码:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<link href="jquery-ui/jquery-ui.css" rel="stylesheet">
<script src="jquery-ui/external/jquery/jquery.js" ></script>
<script src="jquery-ui/jquery-ui.js"></script>
<script>
/** Days to be disabled as an array */
var disableddates = ["20-5-2015", "12-11-2014", "12-25-2014", "12-20-2014"];
function DisableSpecificDates(date) {
var m = date.getMonth();
var d = date.getDate();
var y = date.getFullYear();
// First convert the date in to the mm-dd-yyyy format
// Take note that we will increment the month count by 1
var currentdate = (m + 1) + '-' …Run Code Online (Sandbox Code Playgroud)