|
1 |
| -<!DOCTYPE html> |
| 1 | +<!doctype html> |
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
4 | 4 | <meta charset="utf-8">
|
|
36 | 36 | </style>
|
37 | 37 | <script>
|
38 | 38 | $(function() {
|
39 |
| - function position( using ) { |
| 39 | + function position() { |
40 | 40 | $( ".positionable" ).position({
|
41 | 41 | of: $( "#parent" ),
|
42 | 42 | my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
|
43 | 43 | at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
|
44 | 44 | offset: $( "#offset" ).val(),
|
45 |
| - using: using, |
46 |
| - collision: $( "#collision_horizontal" ).val() + ' ' + $( "#collision_vertical" ).val() |
| 45 | + collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val() |
47 | 46 | });
|
48 | 47 | }
|
49 | 48 |
|
50 | 49 | $( ".positionable" ).css( "opacity", 0.5 );
|
51 | 50 |
|
52 |
| - $( ":input" ).bind( "click keyup change", function() { position(); }); |
| 51 | + $( ":input" ).bind( "click keyup change", position ); |
53 | 52 |
|
54 | 53 | $( "#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 |
68 | 55 | });
|
69 | 56 |
|
70 | 57 | position();
|
|
101 | 88 | <option value="left">left</option>
|
102 | 89 | <option value="center">center</option>
|
103 | 90 | <option value="right">right</option>
|
104 |
| - </select> |
| 91 | + </select> |
105 | 92 | <select id="my_vertical">
|
106 | 93 | <option value="top">top</option>
|
107 | 94 | <option value="middle">center</option>
|
|
123 | 110 | </div>
|
124 | 111 | <div style="padding-bottom: 20px;">
|
125 | 112 | <b>offset:</b>
|
126 |
| - <input id="offset" type="text" size="15"/> |
| 113 | + <input id="offset"> |
127 | 114 | </div>
|
128 | 115 | <div style="padding-bottom: 20px;">
|
129 | 116 | <b>collision:</b>
|
|
0 commit comments