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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:55:11+00:00 2026-05-13T10:55:11+00:00

I have two jquery.ui draggables. I am constraining their movement to the y-axis. If

  • 0

I have two jquery.ui draggables. I am constraining their movement to the y-axis. If one is dragged to a certain y-position, I want the other to automatically move to the same y-position and vice versa. Has anyone ever linked two of these together before?

  • 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-13T10:55:11+00:00Added an answer on May 13, 2026 at 10:55 am

    Updated: Script and demo updated so it is no longer restricted to the y-axis while dragging.

    This script looks for the class “group” followed by a number to drag/drop these combined objects. I posted a demo here.

    HTML

    <div class="demo">
    <div id="draggable">
     <p>Drag from here</p>
     <div class="dragme group1"><img src="image1.jpg"><br>Group 1</div>
     <div class="dragme group1"><img src="image2.jpg"><br>Group 1</div>
     <div class="dragme group2"><img src="image3.jpg"><br>Group 2</div>
     <div class="dragme group2"><img src="image4.jpg"><br>Group 2</div>
    </div>
    <div id="droppable">
     <p>Drop here</p>
    </div>
    </div>
    

    Script

    $(document).ready(function() {
        // function to get matching groups (change '.group' and /group.../ inside the match to whatever class you want to use
        var getAll = function(t) {
            return $('.group' + t.helper.attr('class').match(/group([0-9]+)/)[1]).not(t);
        };
        // add drag functionality
        $(".dragme").draggable({
            revert: true,
            revertDuration: 10,
            // grouped items animate separately, so leave this number low
            containment: '.demo',
            stop: function(e, ui) {
                getAll(ui).css({
                    'top': ui.helper.css('top'),
                    'left': 0
                });
            },
            drag: function(e, ui) {
                getAll(ui).css({
                    'top': ui.helper.css('top'),
                    'left': ui.helper.css('left')
                });
            }
        });
        $("#droppable").droppable({
            drop: function(e, ui) {
                ui.draggable.appendTo($(this));
                getAll(ui).appendTo($(this));
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two jquery(can increase), one of them masterpage and the other is in
I have two JQuery widgets, one is a sort of 'main' widget, the other
I have two JQuery autocomplete's on a screen. One is mandatory, the other is
On my website I have two jQuery UI dialogs. One dialog just shows gif
I have two scripts running on the same page, one is the jQuery.hSlides.js script
I'm using the jQuery Validation JS I have two contact forms, the main one
I have two validation jQuery functions which I need to fire one after another.
I have two divs, one within the other. The outer div (the container) is
Code example: http://jsfiddle.net/MhEPw/1/ I have two jQuery Deferred objects. I want to have more
I have two forms on one html page. Using jQuery, is it possible to

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.