Skip to content

Commit f01db5d

Browse files
committed
Position: Simplify default demo by removing drag functionality on positioned elements. Fixes #5380 - Position Demo breaks when dragging an element.
(cherry picked from commit 6da7278) Conflicts: demos/position/default.html
1 parent 9bf90c6 commit f01db5d

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

demos/position/default.html

+7-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
@@ -36,35 +36,22 @@
3636
</style>
3737
<script>
3838
$(function() {
39-
function position( using ) {
39+
function position() {
4040
$( ".positionable" ).position({
4141
of: $( "#parent" ),
4242
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
4343
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
4444
offset: $( "#offset" ).val(),
45-
using: using,
46-
collision: $( "#collision_horizontal" ).val() + ' ' + $( "#collision_vertical" ).val()
45+
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
4746
});
4847
}
4948

5049
$( ".positionable" ).css( "opacity", 0.5 );
5150

52-
$( ":input" ).bind( "click keyup change", function() { position(); });
51+
$( ":input" ).bind( "click keyup change", position );
5352

5453
$( "#parent" ).draggable({
55-
drag: function() { position(); }
56-
});
57-
58-
$( ".positionable" ).draggable({
59-
drag: function( event, ui ) {
60-
// reset offset before calculating it
61-
$( "#offset" ).val( "0" );
62-
position(function( result ) {
63-
$( "#offset" ).val( "" + ( ui.offset.left - result.left ) +
64-
" " + ( ui.offset.top - result.top ) );
65-
position();
66-
});
67-
}
54+
drag: position
6855
});
6956

7057
position();
@@ -101,7 +88,7 @@
10188
<option value="left">left</option>
10289
<option value="center">center</option>
10390
<option value="right">right</option>
104-
</select>
91+
</select>
10592
<select id="my_vertical">
10693
<option value="top">top</option>
10794
<option value="middle">center</option>
@@ -123,7 +110,7 @@
123110
</div>
124111
<div style="padding-bottom: 20px;">
125112
<b>offset:</b>
126-
<input id="offset" type="text" size="15"/>
113+
<input id="offset">
127114
</div>
128115
<div style="padding-bottom: 20px;">
129116
<b>collision:</b>

0 commit comments

Comments
 (0)