diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-15 14:25:55 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-15 14:27:15 -0400 |
commit | 6da7278e879c0dc734c23231a71fdd92f7a57a0c (patch) | |
tree | 814e36b3ad1297f2b75455b360e537e4eac31ec0 | |
parent | e2a6cdd5256e0befe8f75590499d501141a46463 (diff) | |
download | jquery-ui-6da7278e879c0dc734c23231a71fdd92f7a57a0c.tar.gz jquery-ui-6da7278e879c0dc734c23231a71fdd92f7a57a0c.zip |
Position: Simplify default demo by removing drag functionality on positioned elements. Fixes #5380 - Position Demo breaks when dragging an element.
-rw-r--r-- | demos/position/default.html | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/demos/position/default.html b/demos/position/default.html index 202417348..01137be62 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"> @@ -37,53 +37,28 @@ width: 120px; height: 40px; } - .ui-flipped-top { - border-top: 3px solid #000000; - } - .ui-flipped-bottom { - border-bottom: 3px solid #000000; - } - .ui-flipped-left { - border-left: 3px solid #000000; - } - .ui-flipped-right { - border-right: 3px solid #000000; - } select, input { margin-left: 15px; } </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(); @@ -142,7 +117,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> |