| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <!doctype html> 2 <html lang="en"> 3 <head> 4 <title>jQuery UI Draggable - Constrain movement</title> 5 <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" /> 6 <script type="text/javascript" src="../../jquery-1.3.2.js"></script> 7 <script type="text/javascript" src="../../ui/ui.core.js"></script> 8 <script type="text/javascript" src="../../ui/ui.draggable.js"></script> 9 <link type="text/css" href="../demos.css" rel="stylesheet" /> 10 <style type="text/css"> 11 .draggable { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; } 12 #draggable, #draggable2 { margin-bottom:20px; } 13 #draggable { cursor: n-resize; } 14 #draggable2 { cursor: e-resize; } 15 #containment-wrapper { width: 95%; height:150px; border:2px solid #ccc; padding: 10px;} 16 </style> 17 <script type="text/javascript"> 18 $(function() { 19 $("#draggable").draggable({ axis: 'y' }); 20 $("#draggable2").draggable({ axis: 'x' }); 21 22 $("#draggable3").draggable({ containment: '#containment-wrapper', scroll: false }); 23 $("#draggable4").draggable({ containment: '#demo-frame' }); 24 $("#draggable5").draggable({ containment: 'parent' }); 25 26 }); 27 </script> 28 </head> 29 <body> 30 <div class="demo"> 31 32 <h3 class="docs">Constrain movement along an axis:</h3> 33 34 <div id="draggable" class="draggable ui-widget-content"> 35 <p>I can be dragged only vertically</p> 36 </div> 37 38 <div id="draggable2" class="draggable ui-widget-content"> 39 <p>I can be dragged only horizontally</p> 40 </div> 41 42 <h3 class="docs">Or to within another DOM element:</h3> 43 <div id="containment-wrapper"> 44 <div id="draggable3" class="draggable ui-widget-content"> 45 <p>I'm contained within the box</p> 46 </div> 47 48 <div id="draggable4" class="draggable ui-widget-content"> 49 <p>I'm contained within the box's parent</p> 50 </div> 51 52 <div class="draggable ui-widget-content"> 53 <p id="draggable5" class="ui-widget-header">I'm contained within my parent</p> 54 </div> 55 </div> 56 57 </div><!-- End demo --> 58 59 <div class="demo-description"> 60 61 <p> 62 Constrain the movement of each draggable by defining the boundaries of the draggable area. Set the <code>axis</code> option to limit the draggable's path to the x- or y-axis, or use the <code>containment</code> option to specify a parent DOM element or a jQuery selector, like 'document.' 63 </p> 64 65 </div><!-- End demo-description --> 66 </body> 67 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |