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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:20:20+00:00 2026-05-18T12:20:20+00:00

This is a bit of an obscure issue, but I’m using jQuery Sortables and

  • 0

This is a bit of an obscure issue, but I’m using jQuery Sortables and trying to get two connected lists working together nicely when one is positioned as fixed. It all works fine until you scroll the page a bit such that the two lists end up positioned on top of each other. Then the lists seem to get confused as to which one should be receiving the item that’s being dragged, meaning you get a bunch of jittering happening as it appears/disappears in each list.

It looks like the issue is that both lists are handling the mouse/sort events since the item being dragged is technically over both lists, but what I want is to have the overlayed list (i.e. the position: fixed one) swallow the events so that the underlying main list doesn’t try to receive the item.

Here’s the minimal code example:

<html>
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
    <style type="text/css">
        ul { list-style-type: none; padding: 0; float: left; }
        li { margin: 5px; padding: 5px; width: 500px; border: solid 1px #F00; background-color: #FFF; }
        #overlayed { position: fixed; top: 0; background-color: #000; margin: 20px; padding: 10px; }
        #overlayed li { width: 50px; float: left; }
    </style>
    <script type="text/javascript">
        $(function() {
            $("ul").sortable({ connectWith: "ul", opacity: 0.6 }).disableSelection();
        });
    </script>
</head>
<body>
<div id="overlayed"> 
    <ul>
        <li>Item X</li>
        <li>Item Y</li>
        <li>Item Z</li>
    </ul>
</div>
<br/><br/><br/><br/><br/>
<ul>
    <li>Item 01</li>
    <li>Item 02</li>
    <li>Item 03</li>
    <li>Item 04</li>
    <li>Item 05</li>
    <li>Item 06</li>
    <li>Item 07</li>
    <li>Item 08</li>
    <li>Item 09</li>
    <li>Item 10</li>
    <li>Item 11</li>
    <li>Item 12</li>
    <li>Item 13</li>
    <li>Item 14</li>
    <li>Item 15</li>
    <li>Item 16</li>
    <li>Item 17</li>
    <li>Item 18</li>
    <li>Item 19</li>
    <li>Item 20</li>
    <li>Item 21</li>
    <li>Item 22</li>
    <li>Item 23</li>
    <li>Item 24</li>
    <li>Item 25</li>
    <li>Item 26</li>
    <li>Item 27</li>
    <li>Item 28</li>
    <li>Item 29</li>
    <li>Item 30</li>
</ul>
</body>
</html>

So the question is, how do I fix it?

  • 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-18T12:20:21+00:00Added an answer on May 18, 2026 at 12:20 pm

    I ended up fixing this issue by extending the built in sortable functionality to create a fixedSortable that detects and selectively ignores hovering over lists when there’s a overlay in place. For my purposes, I just hard coded the rules, since that suited my needs/time constraints, but you should be able to make it completely generic without too much effort.

    Firstly here’s the code (explanation below):

    <html>
    <head>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
        <style type="text/css">
            ul { list-style-type: none; padding: 0; float: left; }
            li { margin: 5px; padding: 5px; width: 500px; border: solid 1px #F00; background-color: #FFF; }
            #overlayed { position: fixed; top: 0; background-color: #000; margin: 20px; padding: 10px; }
            #overlayed li { width: 50px; float: left; }
        </style>
        <script type="text/javascript">
            (function ($, undefined) {
                $.widget("ui.fixedSortable", $.ui.sortable, {
                    _init: function () {
                        this.element.data("sortable", this.element.data("fixedSortable"));
                        return $.ui.sortable.prototype._init.apply(this, arguments);
                    },
                    _create:function() {
                        var result = $.ui.sortable.prototype._create.apply(this, arguments);
                        this.containerCache.sortable = this;
                        return result;
                    },
                    _intersectsWithPointer: function (item) {
    //This line....
                        if (item.instance.element.hasClass("main-list") && this.positionAbs.top + this.offset.click.top < $(window).scrollTop() + 87) { 
                            return false;
                        }
                        return $.ui.sortable.prototype._intersectsWithPointer.apply(this, arguments);
                    },
                    _intersectsWith: function(containerCache) {
    //Also this line....
                        if (containerCache.sortable.element.hasClass("main-list") && this.positionAbs.top + this.offset.click.top < $(window).scrollTop() + 87) {
                            return false;
                        }
                        return $.ui.sortable.prototype._intersectsWith.apply(this, arguments);
                    }
                });
            })(jQuery);
    
            $(function() {
                $("ul").fixedSortable({ connectWith: "ul", opacity: 0.6 }).disableSelection();
            });
        </script>
    </head>
    <body>
    <div id="overlayed"> 
        <ul>
            <li>Item X</li>
            <li>Item Y</li>
            <li>Item Z</li>
        </ul>
    </div>
    <br/><br/><br/><br/><br/>
    <ul class="main-list" >
        <li>Item 01</li>
        <li>Item 02</li>
        <li>Item 03</li>
        <li>Item 04</li>
        <li>Item 05</li>
        <li>Item 06</li>
        <li>Item 07</li>
        <li>Item 08</li>
        <li>Item 09</li>
        <li>Item 10</li>
        <li>Item 11</li>
        <li>Item 12</li>
        <li>Item 13</li>
        <li>Item 14</li>
        <li>Item 15</li>
        <li>Item 16</li>
        <li>Item 17</li>
        <li>Item 18</li>
        <li>Item 19</li>
        <li>Item 20</li>
        <li>Item 21</li>
        <li>Item 22</li>
        <li>Item 23</li>
        <li>Item 24</li>
        <li>Item 25</li>
        <li>Item 26</li>
        <li>Item 27</li>
        <li>Item 28</li>
        <li>Item 29</li>
        <li>Item 30</li>
    </ul>
    </body>
    </html>
    

    If adapting this yourself, you’ll need to change the two commented lines marked above. Basically the if statements should evaluate to true (and thus return false) if the item being hovered over (item.instance.element and containerCache.sortable.element) is not the overlay and the event (this) is occurring within the bounds of the overlay. This way the main list never receives events in the location of the page where the overlay is. So in this code the main list doesn’t receive any events if they occur in the top 87 pixels of the screen, since that’s where my fixed overlay was (which is not quite accurate in this dumbed down example, but hopefully it still makes sense).

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

Sidebar

Related Questions

Ok, this is bit of an obscure question, but hopefully someone can help me
Bit of an obscure one this. My setup is all running on my local
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the
I'm trying to understand this bit of code: in display.php: <html> ... <body> <table>
Using c#, VS2005, and .NET 2.0. (XP 32 bit) This is a Winforms app
Ok so this is alittle bit obscure and I'm not sure its the best
Apologies if this question is a bit obscure, I've been banging my head against
I'm trying to implement a simple drag/drop of images between panels using jQuery. While
When I run this bit of code through GCC I get this warning on
I've been messing with this bit of code for over an hour trying 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.