diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-15 14:40:12 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-15 14:42:09 -0400 |
commit | f01db5d8a1321d9f5d8f270aa79ef49574dffaed (patch) | |
tree | 0bb57dace569b2e28dc4db554a2a99163eaaf0eb | |
parent | 9bf90c64f67e32931640200623cdd5a458a5f765 (diff) | |
download | jquery-ui-f01db5d8a1321d9f5d8f270aa79ef49574dffaed.tar.gz jquery-ui-f01db5d8a1321d9f5d8f270aa79ef49574dffaed.zip |
Position: Simplify default demo by removing drag functionality on positioned elements. Fixes #5380 - Position Demo breaks when dragging an element.
(cherry picked from commit 6da7278e879c0dc734c23231a71fdd92f7a57a0c)
Conflicts:
demos/position/default.html
-rw-r--r-- | demos/position/default.html | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/demos/position/default.html b/demos/position/default.html index 4c33f7e8f..54c9331a2 100644 --- a/demos/position/default.html +++ b/demos/position/default.html @@ -1,4 +1,4 @@ -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> @@ -36,35 +36,22 @@ </style> <script> $(function() { - function position( using ) { + function position() { $( ".positionable" ).position({ of: $( "#parent" ), my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(), at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(), offset: $( "#offset" ).val(), - using: using, - collision: $( "#collision_horizontal" ).val() + ' ' + $( "#collision_vertical" ).val() + collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val() }); } $( ".positionable" ).css( "opacity", 0.5 ); - $( ":input" ).bind( "click keyup change", function() { position(); }); + $( ":input" ).bind( "click keyup change", position ); $( "#parent" ).draggable({ - drag: function() { position(); } - }); - - $( ".positionable" ).draggable({ - drag: function( event, ui ) { - // reset offset before calculating it - $( "#offset" ).val( "0" ); - position(function( result ) { - $( "#offset" ).val( "" + ( ui.offset.left - result.left ) + - " " + ( ui.offset.top - result.top ) ); - position(); - }); - } + drag: position }); position(); @@ -101,7 +88,7 @@ <option value="left">left</option> <option value="center">center</option> <option value="right">right</option> - </select> + </select> <select id="my_vertical"> <option value="top">top</option> <option value="middle">center</option> @@ -123,7 +110,7 @@ </div> <div style="padding-bottom: 20px;"> <b>offset:</b> - <input id="offset" type="text" size="15"/> + <input id="offset"> </div> <div style="padding-bottom: 20px;"> <b>collision:</b> |