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 4555420
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:13:23+00:00 2026-05-21T17:13:23+00:00

If I have 2 divs, DIV A and div b (assume both are absolute

  • 0

If I have 2 divs, DIV A and div b (assume both are absolute positioned).. I want to amke it so that when DIV A’s position changes, DIV B (which is the “child” of div A, event though they are two separate divs, not nested), div B’s position changes with the same offsets that div A did. However if I move DIV B’s position… then just DIV B moveS and DIV A’s position is unaffected.

Change in positon would be by dragging the div for example.

If possible, I would like to be able to make it so that I can have a 3rd div, and say its a “child” of div A or B, and the same action would apply. (Ex1. if div C and B are children of div A, then moving div A would update position of DIV C and B)

Ex2. If div C is child of DIV B, then WHen moving DIVA, DIV B and C would be updated. If just DIVB was moved, then DIV B and C would be updated. If moving DIV C, then only DIV C would be updated.

Update:
Hussein’s code is similar to what I want, but the problem is the div of class .b happens to always snap back to where it originally was as opposed to preserving its current position and adding the offset as .a moves.

  • 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-05-21T17:13:24+00:00Added an answer on May 21, 2026 at 5:13 pm

    Assuming you are using jQuery ui draggable(), use the drag event to achieve this. You may need to modify this code further to suit your needs, but the example below should get you on the right track.

    $('.a, .b').draggable({
        drag: function(event, ui) {
            $('.a').css({
                top: ui.offset.top + 'px',
                left: ui.offset.left + 100 + 'px'
            })
        }
    });
    

    Check working example at http://jsfiddle.net/7tDjc/

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

Sidebar

Related Questions

I have two divs inside a div, I want them both adjacent to each
i have three divs like that: <div id=1 >id=1</div> <div id=2>id=2</div> <div id=3>id=3</div> Now
I want to have 3 divs aligned inside a container div, something like this:
I have several vertically stacks divs and I want to have a div appear
I have two divs like so <div id=parent style=width:100px:overflow:hidden;> <div id=child> tooooooooooooooooooooo much content
I have four divs that are draggable. And a div where I drop the
I have three divs : <div id=login /> <div id=content /> <div id=menu />
I have some divs: <div class=A>Target</div> <div class=A B>NotMyTarget</div> <div class=A C>NotMyTarget</div> <div class=A
I have three DIVs, something like this: <div id=header> ... </div> <div id=content> <div
I have 4 divs with content like below: <div class=prodNav-Info-Panel>content</div> <div class=prodNav-Usage-Panel>content</div> <div class=prodNav-Guarantee-Panel>content</div>

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.