jQuery $(ui.draggable).remove()不使用IE [英] jQuery $(ui.draggable).remove() not working with IE
本文介绍了jQuery $(ui.draggable).remove()不使用IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以让IE删除对象,只要它不是当前的可拖动对象。这适用于Chrome和Firefox。有什么我做错了吗?
I can get IE to remove objects as long as it is not the current draggable object. This is working on Chrome and Firefox. Is there something I'm doing wrong?
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
</head>
<body>
<ul id="list">
<li id="test-1" class="dropme">One</li>
<li id="test-2" class="dropme">Two</li>
</ul>
<div id="bucket" style="border:1px solid black">
<p>Drop items here and they should be removed.</p>
</div>
<script>
$("#list").sortable({
items: 'li'
});
$('#bucket').droppable({
drop: function(event, ui) {
$(ui.draggable).remove();
},
accept: '.dropme'
});
</script>
</body>
</html>
推荐答案
ui.draggable和drop函数有点古怪在IE中。试试这个:
The ui.draggable and drop function are a little quirky in IE. Try this:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
</head>
<body>
<ul id="list">
<li id="test-1" class="dropme">One</li>
<li id="test-2" class="dropme">Two</li>
</ul>
<div id="bucket" style="border:1px solid black">
<p>Drop items here and they should be removed.</p>
</div>
<script>
$("#list").sortable({
items: 'li',
stop: function(event, ui) {
if (deleteMe) {
ui.item.remove();
deleteMe = false;
}
}
});
$('#bucket').droppable({
drop: function(event, ui) {
deleteMe = true;
},
accept: '.dropme'
});
</script>
</body>
</html>
这篇关于jQuery $(ui.draggable).remove()不使用IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文