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

  • Home
  • SEARCH
  • 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 8094071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:40:38+00:00 2026-06-05T20:40:38+00:00

How can you get access to the dynamically-changing coordinates of a draggable object? I

  • 0

How can you get access to the dynamically-changing coordinates of a draggable object? I don’t just want the coordinates at stop, but a constant stream of position information.

In other words, if I drag object A around, I should be able to get object B to move around in parallel by (1) observing the changes in object A and then (2) applying them to the position of object B.

In this code, I want the red block (obj2) to move with the blue (obj1).

<html>
<head>
<style>
#obj1 {
   position:fixed;
   top:50px;
   left:50px;
   width: 40px;
   height: 40px;
   background-color: blue;
}
#obj2 {
   position:fixed;
   top:150px;
   left:150px;
   width: 40px;
   height: 40px;
   background-color: red;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(function () {
        $('#obj1').draggable();
    })
</script>
</head>

<body>
    <div id="obj1"></div>
    <div id="obj2"></div>
</body>
</html>
  • 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-05T20:40:40+00:00Added an answer on June 5, 2026 at 8:40 pm

    You can use drag event of draggable:

    $("#obj1").draggable({
        drag: function(event, ui) {
            var pos = ui.position;
            $("#obj2").css({
                left: pos.left + 100,
                top: pos.top + 100
            });
        }
    });​
    

    DEMO: http://jsfiddle.net/kPEfL/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access a member structs variables, but I can't seem to get
This looks like a very simple issue, but I just can't get it to
I want to dynamically access a bunch of objects in my mxml. I can
I want to access the Symfony2 entity methods dynamically by calling it's object. For
Is there any really low level programming language that can get access the memory
How can I get access to the iPhone clipboard whilst using PhoneGap? I cannot
I'd like to have access to one my model field verbose_name. I can get
How can I get the field names of an MS Access database table? Is
I can't get the list of my test users with my app access token.
I'm using Spring Security 3.0.7 How can I get with java code the access

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.