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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:21:41+00:00 2026-06-12T11:21:41+00:00

When a jQueryUI sortable list is in the middle of a dragging operation, is

  • 0

When a jQueryUI sortable list is in the middle of a dragging operation, is there a way to force jQuery to update the position of the placeholder, even if the user is only moving the mouse horizontally? (jQuery’s hit-testing for a vertical sortable seems only to work when the mouse moves vertically too.)

Undocumented or hacky solutions that involve monkeying around with the internals of the sortable, draggable, etc. are OK as a last resort if a documented solution isn’t available.

Here’s more info:

If you drag an item onto the right side of a vertical jQueryUI sortable list, unless you move the mouse up or down the list doesn’t sort. Once you move the mouse up or down (even just 1px!) suddenly the list sorts. Example is at http://jsfiddle.net/f3Lhg/ and excerpted below.

This may seem like a corner case but it’s actually common when connected lists drag sideways from one list to the other. Even if an entire drag isn’t perfectly horizontal, the first 30px-100px might be, leading to unpredictable dragging behavior and lousy user experience. Even though the problem happens more with connected lists, you can easily repro with a single list by dragging out of the list and coming back into the list from the side.

The problem is not browser-specific. Behavior was identical on all browsers I tested with. Also, adding the tolerance option doesn’t solve the problem.

Is this a jQueryUI bug or expected behavior? And are there known workarounds?

BTW, in my app I have connected lists to the right so I can’t use the {axis:'y'} option because that will prevent dragging to the connected lists.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.js"></script>
    <style type="text/css">
    .sortable { list-style-type: none; width: 400px; }
    .sortable li { margin: 5px 0; padding: 30px; border: 1px solid #999; }
    .sortable li.placeholder { margin: 0; height: 4px; border: 0; padding: 0; background-color: #800; }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.sortable').sortable({
                placeholder: 'placeholder'
            }).disableSelection();
        });
    </script>
</head>
<body>
    <ul class="sortable">
        <li>Item #1</li>
        <li>Item #2</li>
        <li>Item #3</li>
        <li>Item #4</li>
        <li>Item #5</li>
    </ul>
</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-12T11:21:42+00:00Added an answer on June 12, 2026 at 11:21 am

    Looking at the jQuery UI source code this appears to be expected behavior.

    Based on how the axis property value is set (or not), jQuery UI sets a property floating as a boolean flag to track whether your container is a vertical or horizontal list (line 46):

    //Let's determine if the items are being displayed horizontally
    this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
    

    This value is used to determine how jQuery UI handles collision detection while the user is dragging an element.

    Specifically:

    The method _intersectsWithSides (line 492) uses the property floating to determine that you are not dragging in a horizontal list and so returns the vertical collision results. The vertical collision check only returns true if there is both a vertical drag direction and an intersection of elements:

    if (this.floating && horizontalDirection) {
        return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
    } else {
        return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
    }
    

    It may be possible to resolve your issue by removing the verticalDirection requirement from the return conditional in _intersectsWithSides (it might also cause unanticipated buggy behaviors).

    Alternatively:

    You can try editing the plugin’s _intersectsWithSides method to return true if there is either a vertical OR horizontal drag:

    return (verticalDirection || horizontalDirection) && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)) || ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello there Iam using Jquery 1.6.2 and JqueryUI 1.8.16 I have a sortable list
i am using this jquery to make a drag and drop sortable list. http://jqueryui.com/demos/sortable/
I need a jQuery to order a list like this: http://jqueryui.com/demos/sortable/ But I need
I using jquery sorting ( http://jqueryui.com/demos/sortable/ ). Is it possible to sort (move list)
I have a sortable list using JQueryUI and use the JQuery Each function to
I have a selector like this: $list = $('ul.sortable'); for jQueryUI's sortable plugin. There
I'm using http://jqueryui.com/demos/sortable/#empty-lists to render a list of elements that an user can select.
I have a sortable list like this one: http://jqueryui.com/demos/sortable Is it possible to get
I just saw this cool feature of JQuery which is JQuery Portlet http://jqueryui.com/demos/sortable/portlets.html I
I have a jQuery UI Sortable list. The sortable items also have a click

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.