Guest

astilla

By: a guest on Oct 2nd, 2007  |  syntax: HTML  |  size: 2.01 KB  |  hits: 266  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4.     <title>Test page</title>
  5.     <script type="text/javascript" src="js/prototype.js"></script>
  6.     <script type="text/javascript" src="js/scriptaculous.js"></script>
  7.     <style type="text/css">
  8.         h3.sectionHeader
  9.         {
  10.             cursor: move;
  11.         }
  12.     </style>
  13. </head>
  14.  
  15. <!--
  16.    Seems to be a problem with 'dropOnEmpty:true' when you are trying to drop
  17.    onto a list (in this case <ol>).  When the internal lists are converted
  18.    to just <div>s the problem goes away and everything works as expected.
  19. -->
  20.  
  21. <div id="sections">
  22.     <div id="section1" class="section">
  23.         <h3 class="sectionHeader">Section 1</h3>
  24.         <ol id="section1Items">
  25.             <li class="item">Item 1</li>
  26.             <li class="item">Item 2</li>
  27.             <li class="item">Item 3</li>
  28.         </ol>
  29.     </div>
  30.     <div id="section2" class="section">
  31.         <h3 class="sectionHeader">Section 2</h3>
  32.         <ol id="section2Items">
  33.             <li class="item">Item 4</li>
  34.             <li class="item">Item 5</li>
  35.             <li class="item">Item 6</li>
  36.         </ol>
  37.     </div>
  38.     <div id="section3" class="section">
  39.         <h3 class="sectionHeader">Section 3</h3>
  40.         <ol id="section3Items">
  41.         </ol>
  42.     </div>
  43. </div>
  44.  
  45. <script type="text/javascript">
  46. //<![CDATA[
  47.  
  48.    var sections = ['section1Items', 'section2Items', 'section3Items'];
  49.  
  50.    Sortable.create('section1Items',{tag:'li',dropOnEmpty:true, containment:sections, only:'item'});
  51.         Sortable.create('section2Items',{tag:'li',dropOnEmpty:true, containment:sections, only:'item'});
  52.         Sortable.create('section3Items',{tag:'li',dropOnEmpty:true, containment:sections, only:'item'});
  53.         Sortable.create('sections',{tag:'div', only:'section',handle:'sectionHeader'});
  54.  
  55. //]]>
  56.  
  57. </body>
  58. </html>