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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:24:18+00:00 2026-06-07T00:24:18+00:00

I am using jQuery UI to make some elements draggable and droppable. Much like

  • 0

I am using jQuery UI to make some elements draggable and droppable. Much like a sortable, I’m trying to arrange the dragged element left/right/above/below to a hovered element when it’s dropped. Also, I want to show an indicator on hovering another element, where the element will be arranged to, when it’s dropped.

The behaviour should be, the the element will be dropped left of the hovered element if the cursor hovers the left third of the element. It should be dropped right of the hovered element if the cursor is above the right third of the hovered element. In script.aculo.us, there’s a parameter called ‘overlap’ which indicates the mouse-overlap in percent of the hovered element.

Is there something similar in jQuery UI or how can this be done?

  • 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-07T00:24:18+00:00Added an answer on June 7, 2026 at 12:24 am

    Ok, here’s one way to do this. Basically, the idea is to read the offset, width and height of a droppable once a draggable is dragged over it. And while an element is dragged and the other element is hovered, the overlap is calculated using the mouse-position, the offset and the dimensions of the element (the offset is subtracted from the mouse-position and compared to the droppable’s dimensions):

    $(function() {
    
        var offx, offy, w, h,
            isOverEl = false;
    
        $( ".component" ).draggable({
           drag: function(event, ui) {
    
             if(!isOverEl) return;
    
             console.log(
               ((event.pageY-offy)/h)*100, // returns vertical overlap in %
               ((event.pageX-offx)/w)*100  //returns horizontal overlap in %
             )
    
           }
        });
    
        $( ".component" ).droppable({
    
        over: function(event, ui) {
    
          var $this  = $(this),
              offset = $this.offset();
    
          offx = offset.left;
          offy = offset.top;
    
          w = $this.outerWidth();
          h = $this.outerHeight();
    
          isOverEl = true;
    
        },
    
        out: function(event, ui) {
          isOverEl = false;
        }
    
      });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've successfully been able to make elements (like div's, panel's, whatever) draggable by using
I am having problems trying to make some of my scrollable elements draggable. I'm
I am using the jQuery accordion plugin to make an accordion of some data.
I'm trying to implement authentication using jquery to make an ajax request to a
I'm trying to make an optional draggable div, which shows up at some condition.
I'm using jQuery's hover() helper to attach some behavior to <li> elements in a
I'm visually collapsing some DOM elements using jQuery (by shrinking their width to 0px
I had an blog using WordPress. I got an jQuery code to make some
I'm using the following jQuery code to hide and show some HTML element in
im using jquery to make ajax requests. is it possible to detect if the

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.