title: Jquery Draggable - center cursorAt Vertically
body: <p>I'm working on my first JQuery project, and i've hit a bit of a roadblock. I'm trying to allow drag &amp; drop reordering of a set of nested lists (ul).  Everything is working with the exception of the positioning. The goal is to vertically center the draggable relative to the cursor (horizontal movement is restricted), so that an li with elements nested inside it can be easily dropped. Here's the relevant JS:</p>
  
  <pre><code>$(function() {
  $( ".organizerlink" ).draggable({ axis: "y",
      containment:"#organizer",
      scroll: false ,
      helper: "original",
      revert: "invalid",
      cursorAt: { top: Math.round($(this).outerHeight() / 2)}
  });
  </code></pre>
  
  <p>and HTML:</p>
  
  <pre><code>&lt;ul id="organizer"&gt;
  &lt;li class="organizerTarget"&gt;&amp;nbsp&lt;/li&gt;
  &lt;li class="organizerlink" id="dbid-1"&gt;Page
      &lt;ul&gt;&lt;li class="organizerTarget organizerNewParent"&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;
  &lt;/li&gt;
  &lt;li class="organizerTarget"&gt;&amp;nbsp&lt;/li&gt;
  &lt;li class="organizerlink" id="dbid-2"&gt;About
      &lt;ul&gt;
          &lt;li class='organizerTarget'&gt;&amp;nbsp;&lt;/li&gt;
          &lt;li class='organizerlink' id="dbid-3"&gt;Another Page&lt;ul&gt;&lt;li class="organizerTarget organizerNewParent"&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
          &lt;li class='organizerTarget'&gt;&amp;nbsp;&lt;/li&gt;
          &lt;li class='organizerlink' id="dbid-4"&gt;Example&lt;ul&gt;&lt;li class="organizerTarget organizerNewParent"&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li class="organizerTarget"&gt;&amp;nbsp&lt;/li&gt;
  &lt;li class="organizerlink" id="dbid-27"&gt;Stuff
      &lt;ul&gt;&lt;li class="organizerTarget organizerNewParent"&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p></p>
  
  <p>Some stuff I've already tried: </p>
  
  <ul>
  <li>setting cursorAt to $(this).height() - didn't work, i'm guessing height() pulls the css heights in, but they aren't defined explicitly so it jumps to 0</li>
  <li>setting it to outerHeight() gives me an error "elem.style is undefined" in firebug</li>
  </ul>
  
  <p>I know the outerHeight element exists in jquery, and based on the <a href="http://api.jquery.com/outerHeight/" rel="noreferrer">API doc</a> it would appear that it can be calculated automatically, even if the CSS is undefined, so I'm thinking that is the right way to be going, and perhaps $(this) is just the wrong spot to be looking for it.</p>