title: Reverse scroll element using jQuery
body: <p><strong>HAVE FOUND THE SOLUTION FOR BELOW PROBLEM :</strong> here is the <a href="http://jsfiddle.net/daneuchar/zHyA9/" rel="nofollow noreferrer">Js Fiddle</a></p>
  
  <p>special thanks to <a href="https://stackoverflow.com/users/1669229/jonhkr">jonhkr</a></p>
  
  <p>I have been working on reverse scroll in jquery and i need help with it. My stuff/code : <a href="http://jsfiddle.net/daneuchar/CZvWC/" rel="nofollow noreferrer">Js Fiddle</a></p>
  
  <p><strong>Achieved:</strong></p>
  
  <ol>
  <li>when the content is scrolled down the rocket moves up.</li>
  </ol>
  
  <p><strong>Problem:</strong></p>
  
  <ol>
  <li>When the rocket is dragged up the content has to scroll down. </li>
  <li>adding "containment" to the drag-able doesn't seem to work. </li>
  <li>this has to work with overflow as hidden.</li>
  </ol>
  
  <p><strong>For those without Fiddle:</strong> </p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div id="test"&gt;
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas eget nisi ipsum. Donec semper, justo at fringilla condimentum, felis tellus ultricies dolor, id convallis metus nulla quis est. Vivamus facilisis orci vel lectus blandit commodo blandit sem tempor. Curabitur condimentum, diam quis pretium feugiat, sem ante pretium tortor, in lobortis massa eros vitae dui. Nullam nisi mauris, condimentum a feugiat in, euismod quis augue. Maecenas euismod adipiscing tellus. Aliquam elementum egestas dolor, vel aliquam nulla tincidunt eget. Etiam risus elit, scelerisque eu volutpat sed, faucibus non ante. Donec sed nunc erat, eget facilisis risus. Etiam id odio tortor. Sed aliquam viverra volutpat. Sed gravida lectus eu mi ornare in feugiat magna elementum. Pellentesque in dolor ligula.
  
  Maecenas condimentum nisl eget arcu elementum nec imperdiet risus lobortis. Suspendisse id placerat turpis. Etiam dolor quam, placerat et volutpat nec, ultricies sed lorem. Fusce volutpat lobortis est ut pellentesque. Donec enim mauris, pretium quis gravida vitae, pellentesque ac nibh. Proin condimentum aliquam scelerisque. Vestibulum aliquet pharetra dapibus. Donec id nisi non nibh fringilla auctor et eget erat. Morbi pretium mauris sed orci pretium aliquam. Nulla pharetra venenatis nunc, in venenatis purus tempor vitae. Vivamus tincidunt dui non eros gravida sit amet consectetur nibh lacinia. 
  
  Maecenas semper ligula et urna tincidunt placerat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse arcu urna, facilisis at tempus id, posuere sed lacus. Vestibulum in feugiat tellus. Nullam suscipit, velit nec tincidunt pellentesque, enim odio ornare mauris, quis faucibus sem sapien sed turpis. Nulla sit amet risus in magna iaculis scelerisque sit amet vel erat. Morbi eu vestibulum nulla. Etiam auctor auctor felis, nec sodales velit condimentum non. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis eu massa diam, eu porttitor eros. Etiam blandit, turpis ac volutpat gravida, massa lorem congue orci, eget fringilla eros felis quis elit. Suspendisse quam tellus, pretium non mattis ut, laoreet in diam. Suspendisse ante odio, venenatis vel condimentum vitae, varius id sapien. Quisque ac nunc ipsum. Mauris porttitor blandit magna, id rutrum ipsum pellentesque non. In suscipit diam ligula, non tristique diam.
  
  Aliquam interdum ante at nisl sagittis vel luctus eros fringilla. Vestibulum purus orci, ultrices at tristique et, malesuada eget enim. Praesent commodo erat vel massa auctor id elementum elit elementum. Duis diam urna, mollis ut imperdiet aliquam, commodo id dui. Etiam vulputate facilisis dui id convall
  
  &lt;/div&gt;
  &lt;div id="track"&gt;
      &lt;div id="rocket"&gt;    
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="xpos" style="clear:both"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>CSS:</strong></p>
  
  <pre><code>#track {
      height: 400px;
      width: 48px;
      overflow: hidden;
      margin: 10px 0 0 10px;
      background:#ccc;
      float:left;
  }
  #rocket{
      height:48px;
      width:48px;
      background:#ccc url('http://www.veryicon.com/icon/preview/System/GANT%203/Rocket,%20This%20is%20a%20damn%20good%20Icon.jpg');
  
  }
  ​
  </code></pre>
  
  <p><strong>JS (JQuery 1.8.2 &amp; Jquery UI):</strong></p>
  
  <pre><code>$(document).ready(function() {
      $(function() {
          var left = parseInt($('#track').css('margin-left'), 10);
          var top = parseInt($('#track').css('margin-top'), 10);
          $("#rocket").draggable({
              containment: "#track",
              axis: "y",
              scroll: false,
              drag: function(event, ui) {
                  // Show the current dragged position of image
                  var currentPos = $(this).position();
                  $("div#xpos").text("CURRENT: \nLeft: " + (currentPos.left - left) + "\nTop: " + (currentPos.top - top));
              }
          });
      });
  });​
  </code></pre>