Skip to content

Commit 56b0da5

Browse files
committed
Fixed #4551 - Sortable connectWith fails if item is floated. Props dhlavety and jlillywhite.
1 parent bf500e6 commit 56b0da5

File tree

2 files changed

+51
-4
lines changed

2 files changed

+51
-4
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Sortable Visual Test : Sortable ticket #4551</title>
5+
<link rel="stylesheet" href="../visual.css" type="text/css" />
6+
<link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
7+
<script type="text/javascript" src="../../../jquery-1.3.2.js"></script>
8+
<script type="text/javascript" src="../../../ui/ui.core.js"></script>
9+
<script type="text/javascript" src="../../../ui/ui.sortable.js"></script>
10+
<script type="text/javascript">
11+
$(function() {
12+
$("#first, #second").sortable({
13+
connectWith: '.sortable'
14+
}).disableSelection();
15+
});
16+
</script>
17+
<style type="text/css">
18+
.sortable { margin: 0; padding: 0; }
19+
.sortable div { margin: 3px 3px 3px 0; background: #ccc; padding: 1px; border: 1px solid black; float:left; width: 100px; height: 140px; font-size: 1em; text-align: center; }
20+
#second div { background: #acc; }
21+
</style>
22+
</head>
23+
<body>
24+
25+
<h1 class="ui-widget-header"><a href="http://dev.jqueryui.com/ticket/4551">#4551 - Sortable connectWith fails if item is floated</a></h1>
26+
27+
<div id="first" class="sortable">
28+
<div>1</div>
29+
<div>2</div>
30+
<div>3</div>
31+
<div>4</div>
32+
<div>5</div>
33+
<div>6</div>
34+
<div>7</div>
35+
<div>8</div>
36+
<div>9</div>
37+
<div>10</div>
38+
<div>11</div>
39+
<div>12</div>
40+
</div>
41+
42+
<br style="clear:both;">
43+
<hr />
44+
45+
<div id="second" class="sortable">
46+
<div>12</div>
47+
<div>14</div>
48+
</div>
49+
50+
</body>
51+
</html>

ui/ui.sortable.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,6 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
570570
for (var i = this.items.length - 1; i >= 0; i--){
571571
var item = this.items[i];
572572

573-
//We ignore calculating positions of all connected containers when we're not over them
574-
if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
575-
continue;
576-
577573
var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
578574

579575
if (!fast) {

0 commit comments

Comments
 (0)