Skip to content

Commit cef66ee

Browse files
author
Paul Bakaus
committed
sortable: Fixed the floating functional demo, implemented forcePlaceholderSize
1 parent fd40ff0 commit cef66ee

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

demos/functional/templates/ui.sortable.ex3.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
<div id="example3">
44

55
<div style="min-height: 50px; min-height:50px; height:auto !important;">
6-
6+
<style type="text/css" media="screen">
7+
#placeholderSortable li {
8+
float: left;
9+
}
10+
</style>
711
<ul id="placeholderSortable" style="list-style-position: inside; height: 30px; cursor: hand; cursor: pointer;">
8-
<li id='user_Jack' style="float: left;">Jack</li>
9-
<li id='user_John' style="float: left;">John</li>
10-
<li id='user_Marry' style="float: left;">Marry</li>
11-
<li id='user_Claire' style="float: left;">Claire</li>
12-
<li id='user_Daniel' style="float: left;">Daniel</li>
12+
<li id='user_Jack'>Jack</li>
13+
<li id='user_John'>John</li>
14+
<li id='user_Marry'>Marry</li>
15+
<li id='user_Claire'>Claire</li>
16+
<li id='user_Daniel'>Daniel</li>
1317
</ul>
1418

1519
</div>

demos/functional/templates/ui.sortable.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
options: [
3939
{
4040
desc: 'Floating, with defined placeholder class',
41-
source: '$("#placeholderSortable").sortable({ placeholder: "ui-selected", revert: true });'
41+
source: '$("#placeholderSortable").sortable({ placeholder: "ui-selected", forcePlaceholderSize: true, revert: true });'
4242
}
4343
]
4444
}

tests/sortable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test("disable", function() {
109109
test("defaults", function() {
110110
el = $("#sortable").sortable();
111111

112-
equals(el.data("helper.sortable"), "clone", "helper");
112+
equals(el.data("helper.sortable"), "original", "helper");
113113
equals(el.data("tolerance.sortable"), "guess", "tolerance");
114114
equals(el.data("distance.sortable"), 1, "distance");
115115
equals(el.data("disabled.sortable"), false, "disabled");

ui/ui.sortable.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
302302
return el;
303303
},
304304
update: function(container, p) {
305-
if(className) return;
306-
if(!p.height()) { p.height(self.currentItem.innerHeight()); };
307-
if(!p.width()) { p.width(self.currentItem.innerWidth()); };
305+
if(className && !o.forcePlaceholderSize) return;
306+
if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0) - parseInt(self.currentItem.css('paddingBottom')||0)); };
307+
if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0) - parseInt(self.currentItem.css('paddingRight')||0)); };
308308
}
309309
};
310310
}

0 commit comments

Comments
 (0)