拖放不工作的网站
drag drop not working in website
当我尝试在jquery中使用拖放时,它在我的项目中不起作用,但是当我在小提琴中复制相同的html时,它正在为我工作。请帮助我为什么它不工作在我的项目,但当我采取相同的代码来摆弄它开始工作。
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
$(function () {
$("#droppable").droppable({
stop: function (event, ui) {
alert('drop');
}
});
$(".draggable").draggable({
containment: 'document',
cursor: 'move',
revert: "invalid",
});
$(".droppable_widget,.draggable_widget").sortable({
connectWith: ".droppable_widget,.draggable_widget",
start: function (event, ui) {
},
stop: function (event, ui) {
var item = $(ui.item);
var to = item.parent().is(".droppable_widget");
var siblingsCount = item.siblings().size();
if (to && siblingsCount > 0) {
alert("only one item allowed here");
return false;
}
}
});
$(".connectedSortable").sortable({
connectWith: ".connectedSortable"
}).disableSelection;
});
<div style="width: 50%; padding-left: 15px; padding-top: 15px; float: left;">
<div id="users"><div class="draggable_widget ui-sortable"><ul class="connectedSortable ui-sortable" id="T1" style="">Team#0<li>1</li><li>1</li><li>2</li><li>2</li></ul></div><div class="draggable_widget ui-sortable"><ul class="connectedSortable ui-sortable" id="T2" style="">Team#1<li style="" class="">2</li><li>2</li></ul></div></div>
</div>
<td class="tcol cnt"> <div><p id="H1">1</p><div style="height:100px;background-color:aqua;width:100px;" class="droppable_widget"></div><br><p id="H1">1A</p><div style="height:100px;background-color:aqua;width:100px;" class="droppable_widget"></div><br></div></td>
替换//与 http://或 https://
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
用
修改以上代码<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
相关文章:
- "此网站似乎使用滚动链接定位效果.这可能不能很好地与异步平移一起工作;
- 代理一个网站能够在iframe中进行所见即所得编辑-它是如何工作的
- 使用HTML和任何服务器端语言(PHP,.net,ruby)制作的网站是否可以在每个具有浏览器的设备上工作
- Toggle已停止在我的网站上工作
- 谷歌脚本-从网站论坛解析HTML-并将数据写入工作表
- 我可以'我似乎没有得到我的网站'移动导航开始工作
- JavaScript网站与工作实例
- 如何在node.js的帮助下使用网站在localhost上工作
- 如何使Asp.net网站同时在IE 11(非可比模式)和IE 8中工作
- 缓存以使我的网站离线是't工作
- jsFiddle工作,网站JS不工作
- 代码在 jsfiddle 中工作,但在我的网站上不起作用
- 我的jQuery在JSFiddle中工作,但不能在我的网站上工作!我做错了什么
- CSS 在基于 URL 上工作,但不在网站的其他页面中使用.代码点火器
- JavaScript不能在一个网站上工作,但在另一个网站上很好
- 如何让Jsfiddles在网站上工作
- 如何让旋转木马为drupal网站工作
- 带宽检查与视频网站(工作在手机和平板电脑)
- 如何DownForEveryoneOrJustMe.com和其他类似的网站工作与跨域脚本限制
- 网站工作,但不是在iphone上.XMLHttpRequest()错误