【发布时间】:2012-04-27 01:33:19
【问题描述】:
我正在使用可排序的 jquery ui。如果没有窗口滚动,我的可分类项目就可以工作并留在安全壳中。 但是,如果我滚动窗口并开始对项目进行排序,我的项目首先移动到与窗口滚动相同的高度,不再粘在鼠标指针上!!! 我做错了什么?
var purchased = [];
$("#listitems").sortable({
revert: true,
containment: '#drop',
stop: function(event, ui) {
purchased = [];
$("#listitems li").each(function () {
var elem = $(this);
var st = elem.attr('id');
if (jQuery.inArray(st, purchased) == -1) {
purchased.push(st);
}
});
console.log(purchased);
}
});
<div id="drop" class="clearfix" style="position:relative;margin:0 auto;min-height:160px;height:auto!important;height:160px;;margin-bottom:20px; border-top:1px solid #D4D4D4;border-bottom:1px solid #DADADA">
<div style="position:absolute;top:-31px;left:10px; z-index:0"><h1 id="depose" style="font-size:2.6em; line-height:1em; color:#EBEBEB; font-weight:700; z-index:0">DRAG HERE</h1></div>
<ul id="listitems" style="position:relative;z-index:11" class="alt_content galerie-thumbs">
<li>image 1</li>
<li>image 2</li>
...
</ul>
</div>
感谢您的帮助...
【问题讨论】:
-
你有过这样的经历吗?我有完全相同的问题:(
-
我也有这个问题,还没有解决方案,但我在 jQuery 板上找到了这个讨论,其中有一些可能适用于某人的潜在解决方案:forum.jquery.com/topic/…