title: On Scroll change dropdown menu drop position
body: <p>Can this be achieved by only modifying the class of the <code>&lt;ui&gt; &lt;li&gt;</code> custom dropdown menu? 
  By just modifying the <code>top, left, right, bottom</code> part and nothing else? Or is there 
  some special magic, if anyone knows a tutorial please share with me. I've been unable to
  find some on the Internet, thanks a lot. </p>
  
  <p>Screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/ZKMpd.png" alt="enter image description here"></p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;ul class="menu openDown"&gt;
      &lt;li&gt;Option 1&lt;/li&gt;
      &lt;li&gt;Option 2&lt;/li&gt;
      &lt;li&gt;Option 3&lt;/li&gt;
      &lt;li&gt;Option 4&lt;/li&gt;
      &lt;li&gt;Option 5&lt;/li&gt;
  &lt;/ul&gt;  
  </code></pre>
  
  <p></p>
  
  <p>Here's a fiddle: </p>
  
  <p><a href="http://jsfiddle.net/heM4v/11/" rel="nofollow noreferrer">http://jsfiddle.net/heM4v/11/</a></p>
  
  <p><strong>EDIT: This MUST be modified on scroll, detecting if the user scrolled down or up, and based on scroll amount, modify the class of the menu to either point up or down. Thanks!</strong></p>
  
  <p><em>EDIT: This post is NOT duplicate since the link (<a href="https://stackoverflow.com/questions/7814186/drop-down-menu-that-opens-up-upward-with-pure-css">Drop-down menu that opens up/upward with pure css</a>), is very different from this one, I want the menu drop direction to depend on the amount of scroll either up/down by the user, meaning determine scroll position and modify the class to either drop the menu up/down. In the Stackoverflow link give this isn't achieved and it's pure CSS hover based, meaning you'd use it in ".no-js" form.</em> </p>
  
  <p><strong>EDIT: Two snippets, not sure if this might help you folks figure it out.</strong> </p>
  
  <pre><code>var menuHeight = $(this).parent().find('.menu').innerHeight();
  
  $(window).scroll(function () {
              var fromTop = $(this).scrollTop() + menuHeight;
              console.log(fromTop); 
          }); 
  </code></pre>
  
  <p><strong>EDIT: The bounty is still open, if someone knows any tutorial or how to achieve this, share your answer, and you will get 50 in reputation points.</strong> </p>