Skip to content

Commit 6da7278

Browse files
committed
Position: Simplify default demo by removing drag functionality on positioned elements. Fixes #5380 - Position Demo breaks when dragging an element.
1 parent e2a6cdd commit 6da7278

File tree

1 file changed

+6
-31
lines changed

1 file changed

+6
-31
lines changed

demos/position/default.html

Lines changed: 6 additions & 31 deletions
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">
@@ -37,53 +37,28 @@
3737
width: 120px;
3838
height: 40px;
3939
}
40-
.ui-flipped-top {
41-
border-top: 3px solid #000000;
42-
}
43-
.ui-flipped-bottom {
44-
border-bottom: 3px solid #000000;
45-
}
46-
.ui-flipped-left {
47-
border-left: 3px solid #000000;
48-
}
49-
.ui-flipped-right {
50-
border-right: 3px solid #000000;
51-
}
5240
select, input {
5341
margin-left: 15px;
5442
}
5543
</style>
5644
<script>
5745
$(function() {
58-
function position( using ) {
46+
function position() {
5947
$( ".positionable" ).position({
6048
of: $( "#parent" ),
6149
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
6250
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
6351
offset: $( "#offset" ).val(),
64-
using: using,
65-
collision: $( "#collision_horizontal" ).val() + ' ' + $( "#collision_vertical" ).val()
52+
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
6653
});
6754
}
6855

6956
$( ".positionable" ).css( "opacity", 0.5 );
7057

71-
$( ":input" ).bind( "click keyup change", function() { position(); });
58+
$( ":input" ).bind( "click keyup change", position );
7259

7360
$( "#parent" ).draggable({
74-
drag: function() { position(); }
75-
});
76-
77-
$( ".positionable" ).draggable({
78-
drag: function( event, ui ) {
79-
// reset offset before calculating it
80-
$( "#offset" ).val( "0" );
81-
position(function( result ) {
82-
$( "#offset" ).val( "" + ( ui.offset.left - result.left ) +
83-
" " + ( ui.offset.top - result.top ) );
84-
position();
85-
});
86-
}
61+
drag: position
8762
});
8863

8964
position();
@@ -142,7 +117,7 @@
142117
</div>
143118
<div style="padding-bottom: 20px;">
144119
<b>offset:</b>
145-
<input id="offset" type="text" size="15"/>
120+
<input id="offset">
146121
</div>
147122
<div style="padding-bottom: 20px;">
148123
<b>collision:</b>

0 commit comments

Comments
 (0)