Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:04:20+00:00 2026-06-14T11:04:20+00:00

HAVE FOUND THE SOLUTION FOR BELOW PROBLEM : here is the Js Fiddle special

  • 0

HAVE FOUND THE SOLUTION FOR BELOW PROBLEM : here is the Js Fiddle

special thanks to jonhkr

I have been working on reverse scroll in jquery and i need help with it. My stuff/code : Js Fiddle

Achieved:

  1. when the content is scrolled down the rocket moves up.

Problem:

  1. When the rocket is dragged up the content has to scroll down.
  2. adding “containment” to the drag-able doesn’t seem to work.
  3. this has to work with overflow as hidden.

For those without Fiddle:

HTML:

<div id="test">
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

</div>
<div id="track">
    <div id="rocket">    
    </div>
</div>
<div id="xpos" style="clear:both">
</div>

CSS:

#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');

}
​

JS (JQuery 1.8.2 & Jquery UI):

$(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));
            }
        });
    });
});​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:04:22+00:00Added an answer on June 14, 2026 at 11:04 am

    I changed a bit your code to solve these problems:

    Adding “containment” to the drag-able doesn’t seem to work.

     var draggingRocket = false;
       $("#test").scroll(function(event) {
           if(!draggingRocket){
                var st = $(this).scrollTop();
                var pos = iHeight - (st / cr);
                $("#rocket").css("top", pos);
           }
       });
    
    
        //rocket drag
        $("#rocket").draggable({
            containment: $('#track'),
            axis: "y",
            scroll: false,
            start: function(event, ui) {
                draggingRocket = true;
            },
            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));
                $("#test").scrollTop(currentPos.top);    
            },
            stop: function(event, ui) {
                draggingRocket = false;
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note, I have found the solution to my problem. Please see below. I'm converting
I have searched the web and have found no definitive solution, so here goes:
I have searched for hours now and haven't found a solution for my problem.
i have this problem: ms-access could not delete and i found a potential solution
I have been searching for a solution to this and so far found nothing
It looks like a problem which could have simple solution, but I haven't found
I've been thinking of this problem, and I have not found a good, efficient
After taking help from StackOverflow, I found the solution that I have implemented below.
I've been working with Bea's solution here for a while and finding it very
I searched for an implementation of std::map runtime ordering and have found this solution:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.